Skip to content

fix: handle accessors in declaration return types - #492

Open
neallin917 wants to merge 2 commits into
LeDDGroup:masterfrom
neallin917:codex/fix-typescript-5-9-accessor-visitor
Open

fix: handle accessors in declaration return types#492
neallin917 wants to merge 2 commits into
LeDDGroup:masterfrom
neallin917:codex/fix-typescript-5-9-accessor-visitor

Conversation

@neallin917

@neallin917 neallin917 commented Jul 29, 2026

Copy link
Copy Markdown

Summary

  • handle bodyless accessors without entering a nested parameter-list lexical environment
  • continue transforming import types in getter and setter annotations
  • add explicit regression coverage for the TypeScript 5.9 declaration-emit crash

Root cause

TypeScript 5.9 suspends the surrounding lexical environment while visiting a function return type. Calling visitEachChild for an accessor nested in that type attempts to start another lexical environment and triggers Debug Failure. False expression: Lexical environment is suspended. This is tracked upstream in microsoft/TypeScript#58020.

The transformer now updates bodyless accessors directly while still visiting their type annotations and parameters.

Fixes #437

Validation

  • yarn fmt:check
  • yarn lint
  • yarn build
  • full test suite on Node.js 22: 52 passed, 0 failed, 1 skipped

AI assistance disclosure

OpenAI Codex was used to investigate the issue, draft the implementation and regression coverage, and run the validation commands listed above.

@neallin917
neallin917 marked this pull request as ready for review July 29, 2026 05:06
@danielpza

Copy link
Copy Markdown
Member

Hello @neallin917, can you add some tests to validate the fix.

Also, please when using AI it would be nice to add a disclosure.

@neallin917

Copy link
Copy Markdown
Author

Thanks for the feedback. I added a named regression test in 63fc37d that verifies the TypeScript 5.9 declaration emit completes and that getter/setter import type paths are rewritten.

I also added an AI-assistance disclosure to the PR description.

Validation:

  • yarn fmt:check
  • yarn lint
  • yarn build
  • yarn test (52 passed, 0 failed, 1 skipped)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incompatibility introduced between TypeScript 5.8.3 and 5.9.2

2 participants