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

verbatimModuleSyntax enables isolatedModules errors, even when isolatedModules is disabled #59186

Closed
daniele-orlando opened this issue Jul 8, 2024 · 7 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@daniele-orlando
Copy link

daniele-orlando commented Jul 8, 2024

πŸ”Ž Search Terms

enum, verbatimModuleSyntax, isolatedModules

πŸ•— Version & Regression Information

TypeScript: 5.5.3

  • This changed between versions 5.4 and 5.5

⏯ Playground Link

Reproduction Project

πŸ’» Code

See the attached project.

πŸ™ Actual behavior

verbatimModuleSyntax = false
isolatedModules = undefined

npx -p [email protected] tsc --showConfig -p tsconfig.verbatime-false.json | grep isolatedModules
// outputs nothing.
// CORRECT

npx -p [email protected] tsc --noEmit -p tsconfig.verbatime-false.json
// PASSES

verbatimModuleSyntax = true
isolatedModules = undefined

npx -p [email protected] tsc --showConfig -p tsconfig.verbatime-true.json | grep isolatedModules
// outputs "isolatedModules": true.
// WRONG

npx -p [email protected] tsc --noEmit -p tsconfig.verbatime-true.json
// FAILS
// ... has a string type, but must have syntactically recognizable string syntax when 'isolatedModules' is enabled.

verbatimModuleSyntax = true
isolatedModules = false

npx -p [email protected] tsc --showConfig -p tsconfig.verbatime-true,isolated-false.json | grep isolatedModules
// outputs "isolatedModules": false.
// CORRECT

// BUT
npx -p [email protected] tsc --noEmit -p tsconfig.verbatime-true,isolated-false.json
// FAILS
// ... has a string type, but must have syntactically recognizable string syntax when 'isolatedModules' is enabled.

πŸ™‚ Expected behavior

Setting verbatimModuleSyntax: true should not enable isolatedModules.
Setting verbatimModuleSyntax: true and isolatedModules: false should disable isolatedModules.

@daniele-orlando
Copy link
Author

At the attention of: @weswigham

@RyanCavanaugh RyanCavanaugh added the Working as Intended The behavior described is the intended behavior; this is not a bug label Jul 9, 2024
@RyanCavanaugh
Copy link
Member

It's always been the intent of VMS to be a superset of IM, see #51479 (comment)

@daniele-orlando
Copy link
Author

Thanks for the clarification.

I think it should be documented inside the doc that verbatimModuleSyntax implies isolatedModules. From what I can see, there is not mention in the Reference TSConfig Documentation.

@daniele-orlando
Copy link
Author

How/where can I report the issue about the documentation?

@jakebailey
Copy link
Member

If you send a PR to https://github.com/microsoft/TypeScript-Website/blob/4503af71d2c4ae95cbc4188a4ce29ca272bd9f57/packages/tsconfig-reference/scripts/tsconfigRules.ts#L201 which marks isolatedModules: trueIf("verbatimModuleSyntax"), that would update the site to show that.

@daniele-orlando
Copy link
Author

Thank you very much @jakebailey. Following you suggestion I opened a PR for the doc website.

microsoft/TypeScript-Website#3179.

@daniele-orlando
Copy link
Author

daniele-orlando commented Jul 10, 2024

I close this issue as it is a documentation issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

3 participants