Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR ports TypeScript PR 61805 to address changes related to the module=node20 configuration, focusing on updates to module resolution behavior and module format handling in Node.js 20 environments.
Key changes include:
- Removal of legacy module resolution validation errors
- Updated module output formats for ESM vs CJS contexts
- Improved import assertion to import attributes error messaging
- Corrected module resolution strategy selection
Reviewed Changes
Copilot reviewed 300 out of 645 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Multiple baseline error files | Removed TS5109 errors requiring Node16 module resolution with Node20 module setting |
| Multiple baseline JavaScript output files | Updated module compilation output to use proper ESM syntax instead of CommonJS when appropriate |
| Import assertion baseline files | Changed error messages from import assertions to import attributes deprecation warnings |
| Module resolution trace files | Updated to show Node16 resolution strategy instead of Bundler |
|
Hm, data race... |
|
I can't figure out how to deal with the circularity errors when compiling concurrently. These are the kinds of errors that we have been silencing by skipping the tests ( |
53306a6 to
38d667c
Compare
|
The circularities are real. I believe what’s going on here is this: suppose you have a big circle of imports: a.ts → b.ts → c.ts → d.ts → e.ts → a.ts. In single-threaded mode, we always start with a.ts because of file order / source order, and we go off down the chain:
With this algorithm, the circle can be arbitrarily long, but we only ever report an error on the place where we start, which is semi-arbitrary but deterministic by file order, source order, etc. But if we divvy up all the files between multiple independent checkers, there’s a strong chance multiple of them will start resolving the chain in different places, resulting in the same error being reported in a different file. I’m not sure what we want to actually do about this.
|
|
That's what I thought, unfortunately. As a non-fix, should the tests be fixed to not use a circular reference? It seems like those which break aren't intentionally testing that behavior. |
|
Yeah, I think that would be fine for now. |
38d667c to
d80e0e6
Compare
|
microsoft/TypeScript#62568 does that, and it indeed makes this PR pass tests when applied to the submodule. |
27032b8 to
9ad82be
Compare
| - [96mindex.ts[0m:[93m1[0m:[93m1[0m | ||
| - [7m1[0m import * as foo from "./foo"; | ||
| - [7m [0m [96m~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m | ||
| + [96mindex.ts[0m:[93m1[0m:[93m1[0m - Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead. |
There was a problem hiding this comment.
Curious difference here; I am not sure if this is something I did? Must have?
There was a problem hiding this comment.
The code that reports this looks a bit different than Strada, so probably not worth blocking this PR on.

Ports microsoft/TypeScript#61805