Skip to content

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

Closed

Description

@webstrand

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.

Activity

  1. added a commit that references this issue on Jun 24, 2022
    6031085
  2. added a commit that references this issue on Jun 27, 2022
    7e91485
  3. locked as resolved and limited conversation to collaborators on Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions