Skip to content

Conversation

@Andarist
Copy link
Contributor

@Andarist Andarist commented Jun 4, 2025

Copilot AI review requested due to automatic review settings June 4, 2025 11:22
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

Ports the fix from the TypeScript repo to prevent a JSDoc-related crash when obtaining the type of a type literal type argument by adding a nil check and caching the symbol before use.

  • Introduce a local sym variable to store node.Symbol()
  • Add sym == nil check in the condition to avoid dereferencing nil

// Deferred resolution of members is handled by resolveObjectTypeMembers
alias := c.getAliasForTypeNode(node)
if len(c.getMembersOfSymbol(node.Symbol())) == 0 && alias == nil {
if sym := node.Symbol(); sym == nil || len(c.getMembersOfSymbol(sym)) == 0 && alias == nil {
Copy link

Copilot AI Jun 4, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider adding parentheses around the second part of the condition to clarify operator precedence, e.g., sym == nil || (len(c.getMembersOfSymbol(sym)) == 0 && alias == nil).

Copilot uses AI. Check for mistakes.
Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

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

We don't have the tests for this yet but this looks correct to me.

@jakebailey jakebailey added this pull request to the merge queue Jun 4, 2025
Merged via the queue into microsoft:main with commit 0c16bc2 Jun 4, 2025
23 checks passed
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