dudykr / stc

Speedy TypeScript type checker
https://stc.dudy.dev
Apache License 2.0
5.77k stars 166 forks source link

Change error code for super in a class property based for <= Es5 #663

Closed kdy1 closed 1 year ago

kdy1 commented 1 year ago

https://github.com/dudykr/stc/blob/94a2b2090d154669348b75f1a40d0899fd90c8a4/crates/stc_ts_type_checker/tests/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers9.ts#L8

The expected error is different for Es5.

See Es5 and Es6

ES5:

============================================================
TS2660

  x SuperCanBeOnlyReferencedInDerivedClass {
  |     span: Span {
  |         lo: BytePos(
  |             130,
  |         ),
  |         hi: BytePos(
  |             135,
  |         ),
  |         ctxt: #0,
  |     },
  | }
   ,-[$DIR/tests/conformance/classes/members/instanceAndStaticMembers/typeOfThisInStaticMembers9.ts:7:1]
 7 | class D extends C {
 8 |     static arrowFunctionBoundary = () => super.f + 1;
   :                                          ^^^^^
 9 |     static functionExprBoundary = function () { return super.f + 2 };
   `----

============================================================
1 unmatched errors out of 6 errors. Got 1 extra errors.
Wanted: [RefError { line: 8, column: 48, code: "TS2340" }]
Unwanted: [(8, "TS2660")]
filipw01 commented 1 year ago

I'm on it

kdy1 commented 1 year ago

Thanks!