Incompatibility introduced between TypeScript 5.8.3 and 5.9.2
When upgrading from TypeScript 5.8.3 to 5.9.2, I'm now getting these errors at build time:
evalmachine.<anonymous>:128647
throw e;
^
Error: Debug Failure. False expression: Lexical environment is suspended.
at Object.startLexicalEnvironment (evalmachine.<anonymous>:121175:11)
at visitParameterList (evalmachine.<anonymous>:95964:11)
at visitEachChildOfGetAccessorDeclaration (evalmachine.<anonymous>:96218:7)
at Object.visitEachChild (evalmachine.<anonymous>:96117:33)
at Object.nodeVisitor (/Users/blimmer/code/my-repo/node_modules/typescript-transform-paths/dist/visitor.js:117:23)
at visitArrayWorker (evalmachine.<anonymous>:95931:49)
at visitNodes2 (evalmachine.<anonymous>:95902:19)
at visitEachChildOfTypeLiteralNode (evalmachine.<anonymous>:96307:7)
at Object.visitEachChild (evalmachine.<anonymous>:96117:33)
at Object.nodeVisitor (/Users/blimmer/code/my-repo/node_modules/typescript-transform-paths/dist/visitor.js:117:23)
Node.js v24.6.0
I'm working to see if I can create a small repro case, but I wanted to file this issue first to see if anyone has ideas on what might be causing this.
@blimmer can you provide a reproduction test case? https://stackblitz.com/github/leddgroup/typescript-transform-paths/tree/master/examples/basic
Here's a repro case: https://stackblitz.com/edit/github-znyza2va?file=src%2Findex.ts
If you use TS @ 5.9.x it fails, but it works with TS @ 5.8.x
Narrowed it down to:
export function MaySkipHooks() {
class SkippableOnce {
get skipHooks() {
return undefined;
}
}
return SkippableOnce;
}
Not sure why but this seems to fail.
@danielpza - thanks for the tag from #427. I tried out the beta version and I'm seeing the error:
> yarn build --noCheck
> yarn add -D [email protected]
➤ YN0000: · Yarn 4.9.1
➤ YN0000: ┌ Resolution step
➤ YN0085: │ + typescript@patch:typescript@npm%3A5.9.3#optional!builtin<compat/typescript>::version=5.9.3&hash=5786d5, and 1 more.
➤ YN0085: │ - typescript@npm:5.8.3, and 1 more.
➤ YN0000: └ Completed
➤ YN0000: ┌ Post-resolution validation
➤ YN0060: │ typescript is listed by your project with version 5.9.3 (pa80e9), which doesn't satisfy what eslint-plugin-storybook and other dependencies request (>=4.8.4 <5.8.0).
➤ YN0002: │ @org/graphql-service@workspace:. doesn't provide @envelop/core (p13767), requested by @envelop/graphql-jit.
➤ YN0086: │ Some peer dependencies are incorrectly met by your project; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code.
➤ YN0086: │ Some peer dependencies are incorrectly met by dependencies; run yarn explain peer-requirements for details.
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed in 0s 299ms
➤ YN0000: ┌ Deduplication step
➤ YN0000: │ No packages can be deduped using the highest strategy
➤ YN0000: └ Completed
➤ YN0000: · Done with warnings in 1s 79ms
> yarn build --noCheck
evalmachine.<anonymous>:128674
throw e;
^
Error: Debug Failure. False expression: Lexical environment is suspended.
at Object.startLexicalEnvironment (evalmachine.<anonymous>:121202:11)
at visitParameterList (evalmachine.<anonymous>:95991:11)
at visitEachChildOfGetAccessorDeclaration (evalmachine.<anonymous>:96245:7)
at Object.visitEachChild (evalmachine.<anonymous>:96144:33)
at Object.nodeVisitor (/Users/me/code/repo/node_modules/typescript-transform-paths/dist/visitor.js:117:23)
at visitArrayWorker (evalmachine.<anonymous>:95958:49)
at visitNodes2 (evalmachine.<anonymous>:95929:19)
at visitEachChildOfTypeLiteralNode (evalmachine.<anonymous>:96334:7)
at Object.visitEachChild (evalmachine.<anonymous>:96144:33)
at Object.nodeVisitor (/Users/me/code/repo/node_modules/typescript-transform-paths/dist/visitor.js:117:23)
Node.js v24.6.0
✘ > yarn add -D typescript-transform-paths@beta
➤ YN0000: · Yarn 4.9.1
➤ YN0000: ┌ Resolution step
➤ YN0085: │ + typescript-transform-paths@npm:4.0.0-beta
➤ YN0085: │ - typescript-transform-paths@npm:3.5.5
➤ YN0000: └ Completed
➤ YN0000: ┌ Post-resolution validation
➤ YN0060: │ typescript is listed by your project with version 5.9.3 (pa80e9), which doesn't satisfy what eslint-plugin-storybook and other dependencies request (>=5.0.0 <5.8.0).
➤ YN0002: │ @org/graphql-service@workspace:. doesn't provide @envelop/core (p13767), requested by @envelop/graphql-jit.
➤ YN0086: │ Some peer dependencies are incorrectly met by your project; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code.
➤ YN0086: │ Some peer dependencies are incorrectly met by dependencies; run yarn explain peer-requirements for details.
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0000: └ Completed in 0s 244ms
➤ YN0000: ┌ Deduplication step
➤ YN0000: │ No packages can be deduped using the highest strategy
➤ YN0000: └ Completed
➤ YN0000: · Done with warnings in 1s 38ms
> yarn build --noCheck
evalmachine.<anonymous>:128674
throw e;
^
Error: Debug Failure. False expression: Lexical environment is suspended.
at Object.startLexicalEnvironment (evalmachine.<anonymous>:121202:11)
at visitParameterList (evalmachine.<anonymous>:95991:11)
at visitEachChildOfGetAccessorDeclaration (evalmachine.<anonymous>:96245:7)
at Object.visitEachChild (evalmachine.<anonymous>:96144:33)
at Object.nodeVisitor (file:///Users/me/code/repo/node_modules/typescript-transform-paths/dist/visitor.js:116:23)
at visitArrayWorker (evalmachine.<anonymous>:95958:49)
at visitNodes2 (evalmachine.<anonymous>:95929:19)
at visitEachChildOfTypeLiteralNode (evalmachine.<anonymous>:96334:7)
at Object.visitEachChild (evalmachine.<anonymous>:96144:33)
at Object.nodeVisitor (file:///Users/me/code/repo/node_modules/typescript-transform-paths/dist/visitor.js:116:23)
Node.js v24.6.0
Per your suggestions in #438, we tried to move to subpath imports, but ran into problems with it. There are issues with barrel-style imports when still using CommonJS. We tried moving to ESM, but ran into issues with the module loader changes.
To avoid all this, we're just using tsx at runtime, which also allowed us to remove typescript-transform-paths (since tsx reads tsconfig.json and the paths "just work").
However, I'm happy to keep testing any changes you make against the old version of our codebase to see if the fix works!