45 lines
1.3 KiB
Plaintext
45 lines
1.3 KiB
Plaintext
tests/cases/compiler/typeIdentityConsidersBrands.ts(30,1): error TS2322: Type 'X_1' is not assignable to type 'Y_1'.
|
|
Types have separate declarations of a private property 'name'.
|
|
tests/cases/compiler/typeIdentityConsidersBrands.ts(31,6): error TS2345: Argument of type 'Y_1' is not assignable to parameter of type 'X_1'.
|
|
Types have separate declarations of a private property 'name'.
|
|
|
|
|
|
==== tests/cases/compiler/typeIdentityConsidersBrands.ts (2 errors) ====
|
|
class X{
|
|
name: string;
|
|
}
|
|
|
|
class Y{
|
|
name: string;
|
|
}
|
|
|
|
class X_1 {
|
|
private name: string;
|
|
}
|
|
|
|
class Y_1 {
|
|
private name: string;
|
|
}
|
|
|
|
function foo(arg: X){}
|
|
|
|
var a = new Y();
|
|
var b = new X();
|
|
|
|
a = b; // ok
|
|
foo(a); // ok
|
|
|
|
var a2 = new Y_1();
|
|
var b2 = new X_1();
|
|
|
|
function foo2(arg: X_1) { }
|
|
|
|
a2 = b2; // should error
|
|
~~
|
|
!!! error TS2322: Type 'X_1' is not assignable to type 'Y_1'.
|
|
!!! error TS2322: Types have separate declarations of a private property 'name'.
|
|
foo2(a2); // should error
|
|
~~
|
|
!!! error TS2345: Argument of type 'Y_1' is not assignable to parameter of type 'X_1'.
|
|
!!! error TS2345: Types have separate declarations of a private property 'name'.
|
|
|