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
{{ message }}
Repository navigation
TS5.5-beta injects a random @ts-expect-error comment in the generated .d.ts files #58698
If the node is the same, it is cloned and it's position is set to -1 in setTextRange. The problem is sometimes the node is a different instance but it has been updated by the visitor (because it's children might have changed), the visitor will preserve original position of the node on the updated node.
This is a problem when we reuse nodes across files, as node emitting considers all nodes that have a !=-1 position as being from the current file and looks for their comment
Activity
nicolo-ribaudo commentedon May 29, 2024
I tried using
every-ts bisect, and this regression has been introduced by #58085 (cc Wesley Wigham (@weswigham)).A simple reproduction that doesn't take 20s to run TS is:
make generate-tsconfigto generate all thetsconfig.jsonfiles./packages/babel-parser, add the files as defined below../packages/babel-parser, runrm tsconfig.tsbuildinfo && rm -rf ./dts-parser && every-ts tsc -b .and check./dts-parser/src/plugins/typescript/index.d.tspackages/babel-parser/tsconfig.json
{ "extends": "../../tsconfig.base.json", "include": ["./src/**/*.ts"], "compilerOptions": { "rootDir": ".", "declarationDir": "./dts-parser" } }packages/babel-parser/src/globals.d.ts
dragomirtitian commentedon May 29, 2024
Investigating this I found:
visitExistingNodeTreeSymbolswill visit child nodes. Then we get to:setTextRange. The problem is sometimes the node is a different instance but it has been updated by the visitor (because it's children might have changed), the visitor will preserve original position of the node on the updated node.!=-1position as being from the current file and looks for their commentdragomirtitian commentedon May 29, 2024
Self contained way to reproduce: Workbench