Skip to content

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

@webstrand

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.

Metadata

Metadata

Assignees

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