Skip to content
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

Incremental compilation with computed property conflicting with type parameter causes spurious error #49562

Closed
webstrand opened this issue Jun 15, 2022 · 0 comments Β· Fixed by #49678
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@webstrand
Copy link
Contributor

Bug Report

πŸ”Ž Search Terms

incremental compilation computed property reference type parameter

πŸ•— Version & Regression Information

  • This changed between versions 3.8.3 and 3.9.7

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

declare const O: unique symbol;
declare class Bar<O> {
  [O]: number  // A computed property name cannot reference a type parameter from its containing type.
}

// DELETE THIS LINE TO TRIGGER ERROR

The playground exhibits the issue, as does tsc --watch.

πŸ™ Actual behavior

After deleting the comment line and triggering incremental compilation, the error message

src/test.ts:4:4 - error TS2467: A computed property name cannot reference a type parameter from its containing type.

3 [O]: number // A computed property name cannot reference a type parameter from its containing type.

appears.

πŸ™‚ Expected behavior

No error should appear after deleting the comment or triggering incremental compilation.

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Jun 15, 2022
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 4.8.1 milestone Jun 15, 2022
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Jun 24, 2022
sheetalkamat added a commit that referenced this issue Jun 27, 2022
…9678)

* Test

* Use value meaning for computed property name
Fixes #49562
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants