Skip to content

Conversation

@TJLSmith0831
Copy link

@TJLSmith0831 TJLSmith0831 commented Jun 22, 2025

Fixes #61892

This PR fixes an issue where using --isolatedDeclarations would incorrectly produce an error (TS9038) for computed properties whose keys are of type unique symbol. This error also prevented these properties from being emitted in the generated declaration file.
The fix modifies the declaration transformer to correctly identify when a computed property's key is a unique symbol. It does this by checking if the resolver creates a TypeQueryNode for the expression, which is how these types are represented during declaration emit. This allows the transformer to bypass the incorrect error and preserve the property in the output .d.ts file as intended.

Testing

I added a new test case to tests/cases/compiler/isolatedDeclarationErrorsClasses.ts which includes a class with a computed property keyed by a unique symbol.
Without the fix, this test case fails with a TS9038 error.
With the fix, the test case no longer produces this error, and the new baseline confirms that the property is correctly emitted in the declaration file.

Checklist

[x] My code follows the style guidelines of this project.
[x] I have added a test that proves my fix is effective.
[x] New and existing unit tests pass locally with my changes.
[x] I have accepted the new baselines.
[x] I have read the CONTRIBUTING.md document.

Note

My laptop did not have the power to run all unit tests across the repo. Got some timeout errors but the compiler and transpile tests ran after accepting the new baselines

@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Jun 22, 2025
@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Jun 22, 2025
@TJLSmith0831
Copy link
Author

@microsoft-github-policy-service agree

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.

I'm not really sure what's going on in this PR. It's adding incorrect errors. The check it's adding does not seem correct (createTypeOfExpression is never used in this manner, and it returning a type node does not make it a unique symbol, and the code that needs to work doesn't involve typeof at all).

I'm not sure this is a good issue for someone who has not touched this part of the code.

@github-project-automation github-project-automation bot moved this from Not started to Waiting on author in PR Backlog Jul 1, 2025
@TJLSmith0831
Copy link
Author

@jakebailey I appreciate the review and response. I wanted to give it a shot and learn more about the inner workings of TS. Bit off more than I could chew on this one. Going to Close the PR 🪓

@github-project-automation github-project-automation bot moved this from Waiting on author to Done in PR Backlog Jul 1, 2025
@microsoft microsoft locked as resolved and limited conversation to collaborators Jan 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Preserve computed property in --isolatedDeclarations emit

3 participants