Skip to content

Conversation

andrewbranch
Copy link
Member

@andrewbranch andrewbranch commented Sep 17, 2025

I ported this thinking it was related to #1720, but it ended up being something else.

@andrewbranch andrewbranch marked this pull request as ready for review September 17, 2025 18:18
@Copilot Copilot AI review requested due to automatic review settings September 17, 2025 18:18
Copy link
Contributor

@Copilot 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 ports late bound class property declaration emit functionality from the TypeScript compiler. The main goal is to improve how computed property names are handled in declaration files, specifically by preserving the actual computed names instead of falling back to generic index signatures.

  • Adds support for tracking computed property name components in IndexInfo structures
  • Implements logic to emit individual property declarations for late-bound properties when serializable
  • Updates test baselines to reflect improved computed property name handling in declarations

Reviewed Changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/checker/types.go Adds components field to IndexInfo struct to track computed property names
internal/checker/inference.go Updates IndexInfo constructor calls to include new components parameter
internal/checker/emitresolver.go Implements core logic for emitting late-bound property declarations
internal/checker/checker.go Updates all IndexInfo creation sites and adds computed name detection
internal/ast/ast.go Adds QuestionToken method for accessing question tokens from various node types
Test baseline files Updated to reflect improved computed property name preservation

Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

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

There's also still the generated type cases to handle through the missing (very similar) logic in createTypeNodesFromResolvedType in the node builder (namely: the missing indexInfoToObjectComputedNamesOrSignatureDeclaration call layer - probably shoulda left that in with a !!! rather than inlining the finished part of the call).

@andrewbranch andrewbranch added this pull request to the merge queue Sep 17, 2025
Merged via the queue into microsoft:main with commit 1ca5a2d Sep 17, 2025
22 checks passed
@andrewbranch andrewbranch deleted the class-computed-property-declaration-emit branch September 17, 2025 20:12
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