Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Adding comment about file inclusion in TS section #888

Merged
merged 1 commit into from
Oct 6, 2021

Conversation

rschristian
Copy link
Collaborator

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 using tsc are suddenly not included when using Microbundle.

@changeset-bot
Copy link

changeset-bot bot commented Sep 3, 2021

⚠️ No Changeset found

Latest commit: ca4cc2b

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.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

Copy link

@AndyOGo AndyOGo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for clarification!

I would explicitly mention that ts configs like typeRoots wont work.

@rschristian
Copy link
Collaborator Author

@AndyOGo Hm, that's not a Microbundle thing. TSC wouldn't do anything differently. That's just not what that typeRoots is for.

@AndyOGo
Copy link

AndyOGo commented Sep 3, 2021

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.

@rschristian
Copy link
Collaborator Author

rschristian commented Sep 3, 2021

@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.

@developit developit merged commit 76272fd into master Oct 6, 2021
@developit developit deleted the docs/ts-includes branch October 6, 2021 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TS7016: Could not find a declaration file for module
3 participants