Closed rschristian closed 2 years ago
Latest commit: ca4cc2b62130e5fe6f8a6fd734b143881ad002d6
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
@AndyOGo Hm, that's not a Microbundle thing. TSC wouldn't do anything differently. That's just not what that typeRoots
is for.
Thanks for your answer.
I have custum definition files, which I usually add by using typeRoots. And it works stable with tsc.
Though with microbundle it wont work.
My guess is because the default includes is */, but if files is specified then includes default is an empty array. I could be wrong though.
@AndyOGo
It's exactly that, yeah. By default include
covers everything, so tsc
will include those ambient declarations. As Microbundle needs to alter what's included, you as the user need to specify.
Though I should say typeRoots
isn't actually doing anything for you in that repo you provided. Ambient declarations will be picked up so long as they're included by files
or include
. You don't need typeRoots
there are all. It has no effect.
Edit: It seems the only real use for typeRoots
is if you wanted to say ignore all of @types/
and define your own versions maybe? Honestly I'm not too sure. The docs don't actually seem to cover when you'd want to use the option.
Closes #807
When building with TypeScript, we provide a default value for
"files"
which has the side effect of altering what files are included for compilation with Microbundle. While this is intentional (see #621) it isn't exactly obvious to users why files included when usingtsc
are suddenly not included when using Microbundle.