chore: use typescript 6, remove esmoduleInteropFlag#16276
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the repo’s TypeScript toolchain by bumping the TypeScript compiler version and simplifying the type-test tsconfig by removing an explicit esModuleInterop override.
Changes:
- Bump
typescriptdevDependency from5.9.3to6.0.3. - Remove
esModuleInterop: falsefromtest/types/tsconfig.json(relying on defaults/inherited config).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
package.json |
Updates the TypeScript compiler version used by repo tooling (linting/type tests/bench workflows that use the root install). |
test/types/tsconfig.json |
Removes an explicit esModuleInterop setting from the type-test TS config. |
| "pug": "3.0.4", | ||
| "sinon": "21.1.2", | ||
| "tstyche": "^7.0.0", | ||
| "typescript": "5.9.3", | ||
| "typescript": "6.0.3", | ||
| "typescript-eslint": "^8.31.1", |
There was a problem hiding this comment.
I wonder if we should run our tests on both TS 5 and 6 versions, the same way we run our js tests on a matrix of node and mongo versions. That way we guarantee our code works in both TS versions.
There was a problem hiding this comment.
That would be a substantial change from our current policy of "only latest TypeScript is supported", which could be a big source of headache. Are you upgrading to TypeScript 6 or are you planning on staying on TypeScript 5 for the foreseeable future?
There was a problem hiding this comment.
I'm not currently using mongoose in any project I'm maintaining, I'd probably update TS to the latest version if I were.
only latest TypeScript is supported
Fair enough.
I see you changed this to 9.7 which makes things better.
AbdelrahmanHafez
left a comment
There was a problem hiding this comment.
Other than Copilot's comment LGTM
| "compilerOptions": { | ||
| "esModuleInterop": false, | ||
| "strict": true, | ||
| "allowSyntheticDefaultImports": true, |
There was a problem hiding this comment.
Perhaps it is worth removing allowSyntheticDefaultImports as well?
Same as esModuleInterop, TS6 deprecates setting allowSyntheticDefaultImports: false (reference).
Seems like it was added here together with esModuleInterop: false, because that would result in having allowSyntheticDefaultImports: false (reference). So it feels like both can be removed for TS6.
| "allowSyntheticDefaultImports": true, |
|
I just saw the Milestone for this, consider moving this change to at least the next minor version. |
Summary
Replaces #16255: turns out we also need to remove esModuleInterop option. Removing
esModuleInteropshouldn't affect anything sinceesModuleInterop: falseis the default anyway.Examples