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

v11: fix for typescript definitions when using isolated modules #1627

Merged
merged 4 commits into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/odd-insects-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@emotion/styled': patch
---

Fix for TypeScript error when importing `@emotion/styled/base` in combination with `isolatedModules` option.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/styled/types/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"compilerOptions": {
"baseUrl": "../",
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
Copy link
Member

Choose a reason for hiding this comment

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

do you see any downsides of using this in here? I can't think of any, cc @JakeGinnivan

Copy link
Contributor Author

Choose a reason for hiding this comment

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

isolatedModules will cause the compilation to emit errors if the code is not able to be transpiled in single-file mode (ie. babel or ts.transpile). So it will raise errors for doing type re-exports or using const enums. AFAIK all other errors will also be emitted so I think it is safe to keep it turned on and it may even be worth adding it to the other configuration files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some info about the impact here: microsoft/TypeScript#16351

Copy link
Member

Choose a reason for hiding this comment

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

it may even be worth adding it to the other configuration files.

Yeah, I was thinking about this as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense to me 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can add that to the PR if you want when I get home this evening.

Copy link
Member

Choose a reason for hiding this comment

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

Merged this one in as we can add this flag in other configs in separate PR. Thanks for the fix!

"jsx": "react",
"lib": [
"es6",
Expand Down