stc icon indicating copy to clipboard operation
stc copied to clipboard

Remove normalization of `TS2741` as `TS2322`

Open kdy1 opened this issue 1 year ago • 2 comments

This is for 1.0, not alpha nor 0.1

Discussed in https://github.com/dudykr/stc/discussions/767

Originally posted by kdy1 February 28, 2023 I decided to normalize TS2741 as TS2322 for alpha because of the following case.

https://www.typescriptlang.org/play?#code/MYGwhgzhAEDC0G9oF8BQpIwCLQKYA8AXXAOwBMZ4kAzAe1oEYAKASkRRXXCmgFE8ipCnHZ1aAJlbtknVGVwYATrmgA3MIuhkAXNCwBuOQvDK1GvLt6HUAehvQAgtACuJAJa0S0QgE8ADioAqtBuMJhuAOYkYABGICqEtNBg3v4qACoh1HhgwAAWqQEhXsGhyVCR0XEJSely0AC8eIYqTWTWZI3NqK1ahkA

class C { }
class D extends C { foo1() { } }
class E extends C { foo2() { } }

declare var d: D;
declare var e: E;

// A union type U is assignable to a type T if each type in U is assignable to T
d = e;
e = d;

d = e;
e = d;

Error

Property 'foo1' is missing in type 'E' but required in type 'D'.
Property 'foo2' is missing in type 'D' but required in type 'E'.
Type 'E' is not assignable to type 'D'.
Type 'D' is not assignable to type 'E'.

So it means we should report TS2741 only for the first error.

kdy1 avatar Feb 28 '23 11:02 kdy1

Has this issue been resolved?

sunrabbit123 avatar Apr 11 '23 07:04 sunrabbit123

No, but I found that tsc is emitting TS2741 only for the first error, so I think TS2741 vs TS2322 is meaningless for now

kdy1 avatar Apr 11 '23 08:04 kdy1