microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.26k stars 12.52k forks source link

Implementing a prim type in a class expression should report error #60484

Closed bvanjoi closed 1 week ago

bvanjoi commented 2 weeks ago

🔎 Search Terms

class expression implement primitive type

🕗 Version & Regression Information

⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.3.3#code/MYewdgzgLgBAgjAvDYAbAhhCMBCMCWAtgA6oCmhZYU2YAroQEZkBOMA3gL4BQ3am2AMIES5StVoNmbLkA

💻 Code

class C implements number {} // report that class cannot implement primitive type

const A = class B implements number {} // this code should report the same error, but it actually does not.

🙁 Actual behavior

Refer to the comment above

🙂 Expected behavior

Refer to the comment above

Additional information about the issue

No response

jcalz commented 2 weeks ago

Looks like #55712