Skip to content

chore: slight tsconfig adjustments; add comments on each options#944

Merged
haoqunjiang merged 2 commits intovuejs:mainfrom
haoqunjiang:chore/tsconfig-comments
Feb 28, 2026
Merged

chore: slight tsconfig adjustments; add comments on each options#944
haoqunjiang merged 2 commits intovuejs:mainfrom
haoqunjiang:chore/tsconfig-comments

Conversation

@haoqunjiang
Copy link
Member

@haoqunjiang haoqunjiang commented Feb 26, 2026

Notable changes:

  • compilerOptions.module is changed from ESNext to preserve in tsconfig.node.json because it better reflects the reality of the runtimes and bundlers.
  • Explicitly set noUncheckedIndexAccess to true in the user project because it could result in false positives. I plan to revert the base @vue/tsconfig change so that old projects can upgrade. But new projects should turn that option on as recommended by tsc --init. More discussions at When using the array type, is the type inference incorrect? tsconfig#38 (comment)
  • Previously, the tsconfig.*.json files were in pure JSON format. After this change, they are JSONC files. I believe most tools in the TypeScript ecosystem can handle that well. GitHub's syntax highlighting can be slightly improved (turn the comments into grey instead of red) if we provide a .gitattribute file like in https://github.com/vuejs/tsconfig/blob/main/.gitattributes, but I'm not sure if that's really necessary…

Notable changes:
- `compilerOptions.module` is changed from `ESNext` to `preserve` in
  `tsconfig.node.json` because it better reflects the reality of the
  runtimes and bundlers.
- Explicitly set `noUncheckedIndexAccess` to `true` in the user project
  because it could result in false positives. I plan to revert the base
  `@vue/tsconfig` change so that old projects can upgrade. But new
  projects should turn that option on as recommended by `tsc --init`.
  More discussions at vuejs/tsconfig#38 (comment)
- Previously the `tsconfig.*.json` files are in pure JSON format. After
  this change, they are JSONC files. I believe most tools in the
  TypeScript ecosystem handles that well. But not GitHub. I'm not sure
  if I should add a `.gitattributes` file in the root directory to fix
  the syntax highlighting as in https://github.com/vuejs/tsconfig/blob/main/.gitattributes
@haoqunjiang
Copy link
Member Author

haoqunjiang commented Feb 26, 2026

It partially addresses #265, but it's still not comprehensive documentation yet.
Partly because I've actually forgotten why some of the options are there 😂 I'll leave them for next time.

@haoqunjiang haoqunjiang merged commit 0836597 into vuejs:main Feb 28, 2026
39 checks passed
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.

2 participants