Skip to content

[WIP] Port TypeScript PR #60195: Assume that type node annotations resolving to error types can be reused #1137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jun 10, 2025

Port TypeScript PR #60195: Assume that type node annotations resolving to error types can be reused

Plan:

  • Analyze the original TypeScript PR changes
  • Locate the equivalent Go code in internal/checker/nodebuilderimpl.go
  • Identify the exact function and location for the change
  • Add error type check in tryReuseExistingNonParameterTypeNode function
  • Build and test the change
  • Run baseline tests and accept changes
  • Validate the fix works correctly

Change Details:

The original TypeScript PR adds a check in the type node reuse logic to allow reusing type nodes that resolve to error types. This prevents cascading errors in isolatedDeclarations when there are already type errors in the source.

In the Go port, this needs to be added in internal/checker/nodebuilderimpl.go in the tryReuseExistingNonParameterTypeNode function, right after the annotationType = b.getTypeFromTypeNode(existing, true) call.

Fixes #1118.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: andrewbranch <3277153+andrewbranch@users.noreply.github.com>
@weswigham
Copy link
Member

In the go port, this codepath is untested and unused at present, along with all the nodebuilder node-reuse logic, so can't be verified as doing that the original PR intended until that's in.

@weswigham weswigham closed this Jun 10, 2025
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

Error loading sessions

Retrying...

Successfully merging this pull request may close these issues.

Port TypeScript PR #60195: Assume that type node annotations resolving to error types can be reused
3 participants