Skip to content

Use NodeIsMissing in typeeraser.go where Strada did#3184

Open
jakebailey wants to merge 1 commit intomainfrom
jabaile/fix-type-eraser-missing-node
Open

Use NodeIsMissing in typeeraser.go where Strada did#3184
jakebailey wants to merge 1 commit intomainfrom
jabaile/fix-type-eraser-missing-node

Conversation

@jakebailey
Copy link
Member

Fixes a few diffs. These are all in error cases, though.

Copilot AI review requested due to automatic review settings March 20, 2026 22:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aligns the Go TypeScript transformer’s handling of “missing” function-like bodies with TypeScript’s behavior by using ast.NodeIsMissing (not just nil checks), eliminating several error-recovery emit mismatches and thereby reducing baseline diffs.

Changes:

  • Update TypeEraserTransformer to treat empty-range (“missing”) bodies the same as nil bodies when deciding to elide overload-like declarations.
  • Refresh affected reference baselines to reflect the corrected elision behavior (removing previously-emitted stub functions / adjusting emitted module markers).

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/transformers/tstransforms/typeeraser.go Uses ast.NodeIsMissing for constructor/method/function/accessor body checks so missing bodies created by error recovery don’t get emitted as empty stubs.
testdata/baselines/reference/submodule/conformance/typeGuardFunctionErrors.js.diff Updates golden diff output after correcting erroneous stub emission.
testdata/baselines/reference/submodule/conformance/typeGuardFunctionErrors.js Removes previously-emitted stub functions from the baseline output.
testdata/baselines/reference/submodule/conformance/thisTypeInFunctionsNegative.js.diff Updates golden diff output after correcting erroneous stub emission.
testdata/baselines/reference/submodule/conformance/thisTypeInFunctionsNegative.js Removes previously-emitted stub function from the baseline output.
testdata/baselines/reference/submodule/conformance/parserErrantEqualsGreaterThanAfterFunction2.js.diff Updates golden diff output after correcting erroneous stub emission.
testdata/baselines/reference/submodule/conformance/parserErrantEqualsGreaterThanAfterFunction2.js Removes previously-emitted stub function from the baseline output.
testdata/baselines/reference/submodule/conformance/jsdocDisallowedInTypescript.js.diff Updates golden diff output after correcting erroneous stub emission.
testdata/baselines/reference/submodule/conformance/jsdocDisallowedInTypescript.js Removes previously-emitted stub functions from the baseline output.
testdata/baselines/reference/submodule/compiler/reachabilityChecksNoCrash1.js.diff Updates golden diff output after correcting erroneous stub emission and output shape.
testdata/baselines/reference/submodule/compiler/reachabilityChecksNoCrash1.js Removes previously-emitted stub signature and restores/updates module marker emission (export {}) in baseline output.
testdata/baselines/reference/submodule/compiler/parseErrorIncorrectReturnToken.js.diff Updates golden diff output after correcting erroneous stub emission.
testdata/baselines/reference/submodule/compiler/parseErrorIncorrectReturnToken.js Removes previously-emitted object-literal stub from baseline output.
testdata/baselines/reference/submodule/compiler/dottedModuleName.js.diff Updates golden diff output after correcting erroneous stub emission.
testdata/baselines/reference/submodule/compiler/dottedModuleName.js Removes previously-emitted stub function assignment from baseline output.

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.

2 participants