You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
index.ts:1:30 - error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
1 import foo from "./foo.json" with { type: "json" };
~~~~~~~~~~~~~~~~~~~~~
π Expected behavior
No error because module defaults to esnext.
Additional information about the issue
In Announcing TypeScript 6.0, it says module defaults to esnext: Similarly, the new default module is esnext, acknowledging that ESM is now the dominant module format.
But in TSConfig Reference, it's CommonJS if target is ES5; ES6/ES2015 otherwise.
In the code, I don't think the default value is esnext. Otherwise, we wouldn't be getting the TS2823 error.
This also made me notice that the documentation for the default value of target is currently wrong (at least the "ES5 otherwise" bit). This section also still mentions ES3 as an allowed target value, but that's no longer true.
Re-reading that list item in the announcement post, I wonder if it's just a typo/editing mistake. Setting aside the incorrect information, the prose weirdly repeats itself ("module defaults to esnext: Similarly, the new default module is esnext"). I can't figure out what it's supposed to be saying, though.
This isn't directly related to the specific thing called out by this issue, but I noticed another minor problem in the announcement post. The "Deprecated: outFile" section says "The --outFile option has been removed from TypeScript 6.0", but that's not true (it's merely been deprecated). Maybe this sentence was supposed to say "7.0" instead of "6.0".
The docs are getting harder to follow with this last release. The updates to compiler setting defaults don't appear to have been synced with the other core pages (as mentioned above around the module field)?
It updates the documented default for module in tsconfigRules.ts to reflect the current computation logic (derived from target, not the old ES5/ES2015 split).
Activity
mkantor commentedon Apr 1, 2026
I suspect that
moduleis actually currently defaulting toes2022.Since #63067,
targetdefaults toScriptTarget.LatestStandard, which is currentlyes2025, and that means the computed default formoduleises2022.Also, I get the same error message with
npx tsc --module es2022 index.ts.mkantor commentedon Apr 1, 2026
This also made me notice that the documentation for the default value of
targetis currently wrong (at least the "ES5otherwise" bit). This section also still mentionsES3as an allowedtargetvalue, but that's no longer true.mkantor commentedon Apr 1, 2026
Re-reading that list item in the announcement post, I wonder if it's just a typo/editing mistake. Setting aside the incorrect information, the prose weirdly repeats itself ("
moduledefaults toesnext: Similarly, the new defaultmoduleisesnext"). I can't figure out what it's supposed to be saying, though.mkantor commentedon Apr 14, 2026
This isn't directly related to the specific thing called out by this issue, but I noticed another minor problem in the announcement post. The "Deprecated:
outFile" section says "The--outFileoption has been removed from TypeScript 6.0", but that's not true (it's merely been deprecated). Maybe this sentence was supposed to say "7.0" instead of "6.0".matthewbordas commentedon May 19, 2026
Sébastien Règne (@regseb) Matt Kantor (@mkantor) I'm also seeing interesting behavior most likely related to this and put some notes together here.
The docs are getting harder to follow with this last release. The updates to compiler setting defaults don't appear to have been synced with the other core pages (as mentioned above around the module field)?
mkantor commentedon May 19, 2026
Yeah, https://typescriptlang.org/tsconfig is in need of updates (perhaps other documentation pages too). See #63392.
docs: update module and target default values for TypeScript 6+
jonkoops commentedon Jul 9, 2026
I've opened a PR to fix this on the documentation website: microsoft/TypeScript-Website#3608
It updates the documented default for
moduleintsconfigRules.tsto reflect the current computation logic (derived fromtarget, not the old ES5/ES2015 split).βͺ revert: 308a0d5