Skip to content

fix(declarations): Allow unique symbol computed properties with --isolatedDeclarations #61911

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
Status: Not started
Development

Successfully merging this pull request may close these issues.

Preserve computed property in --isolatedDeclarations emit
2 participants