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

When verbatimModuleSyntax: true, allow an explicit isolatedModules: true #53601

Closed
MuleaneEve opened this issue Mar 31, 2023 · 6 comments · Fixed by #53611
Closed

When verbatimModuleSyntax: true, allow an explicit isolatedModules: true #53601

MuleaneEve opened this issue Mar 31, 2023 · 6 comments · Fixed by #53611
Assignees
Labels
Experience Enhancement Noncontroversial enhancements Fix Available A PR has been opened for this issue Suggestion An idea for TypeScript

Comments

@MuleaneEve
Copy link

Bug Report

The new verbatimModuleSyntax implies isolatedModules, which is fine. However, it also prevents us from specifying isolatedModules: true explicitly, which should also be fine.

This is an issue in a Next.js app because its build process will force "isolatedModules: true" to be present. This issue has been reported on their side as well.

So it is currently impossible to upgrade a Next.js app to TypeScript 5.

Existing bug reports

This issue was not taken into consideration:

#53374
#53160

🕗 Version & Regression Information

TypeScript 5.0

🙁 Actual behavior

Type error: Option 'isolatedModules' is redundant and cannot be specified with option 'verbatimModuleSyntax'.

🙂 Expected behavior

verbatimModuleSyntax: true should allow isolatedModules: true.

@fatcerberus
Copy link

This is an issue in a Next.js app because its build process will force "isolatedModules: true" to be present.

I sure hope somebody picks up that phone, because I called it!

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Mar 31, 2023
@andrewbranch andrewbranch added Suggestion An idea for TypeScript Experience Enhancement Noncontroversial enhancements and removed Needs Investigation This issue needs a team member to investigate its status. labels Mar 31, 2023
@andrewbranch andrewbranch added this to the TypeScript 5.0.4 milestone Mar 31, 2023
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Mar 31, 2023
@GitMurf
Copy link

GitMurf commented Apr 5, 2023

While we are waiting for the fix to be applied to v5.0.4 and released, is there a workaround to get this working? Is the only option to set isolatedModules to false until 5.0.4 comes out? Thanks!

GitMurf added a commit to GitMurf/chrome-extension-svelte-typescript-boilerplate that referenced this issue Apr 5, 2023
… that broke when it is set to true.

See details here on PR that should fix in next release 5.0.4: microsoft/TypeScript#53611

When 5.0.4 comes out, need to flip isolatedModules back to true

Here is details on the issue: microsoft/TypeScript#53601
@fatcerberus
Copy link

@GitMurf The workaround is to not have isolatedModules in your config at all, since isolatedModules: true is implied by verbatimModuleSyntax: true. Setting it to false is actively contradictory and will not fix this error.

@GitMurf
Copy link

GitMurf commented Apr 5, 2023

@fatcerberus thanks for the quick response! So you mean just remove (or comment out) the isolateModules from the tsconfig all together? And effectively then I will have the same settings via the verbatimModuleSyntax?

@fatcerberus
Copy link

@GitMurf Yes. Behavior under verbatimModuleSyntax is a superset of isolatedModules. That's why the current error message says the latter option is redundant.

@nyngwang
Copy link

nyngwang commented Mar 8, 2024

@fatcerberus How did you know it's a superset? (this is sincerely asking as I'm beginner) I came from the docs: https://www.typescriptlang.org/docs/handbook/modules/guides/choosing-compiler-options.html#im-using-a-bundler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Experience Enhancement Noncontroversial enhancements Fix Available A PR has been opened for this issue Suggestion An idea for TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants