Closed
Description
From typings/typings#380. It's definitely unexpected and I can't understand why, but I see in the specification it's intentional. For example:
export class Test {
private method () {}
}
export class Test2 {
private method () {}
}
export function compare (t: Test) {}
compare(new Test2())
Expected behavior:
No error, they are structurally the same. Private and protected methods can not be used outside of the class, so it shouldn't affect assignability.
Actual behavior:
index.ts(11,9): error TS2345: Argument of type 'Test2' is not assignable to parameter of type 'Test'.
Types have separate declarations of a private property 'method'.
Edit: From the issue in typings
, I also linked to #6496 and #6365 which appear to describe the issue but only dive into workarounds instead of validating why this is happening.