280 lines
4.2 KiB
Text
280 lines
4.2 KiB
Text
=== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/objectTypesIdentityWithPublics.ts ===
|
|
// object types are identical structurally
|
|
|
|
class A {
|
|
>A : A
|
|
|
|
public foo: string;
|
|
>foo : string
|
|
}
|
|
|
|
class B {
|
|
>B : B
|
|
|
|
public foo: string;
|
|
>foo : string
|
|
}
|
|
|
|
class C<T> {
|
|
>C : C<T>
|
|
>T : T
|
|
|
|
public foo: T;
|
|
>foo : T
|
|
>T : T
|
|
}
|
|
|
|
interface I {
|
|
>I : I
|
|
|
|
foo: string;
|
|
>foo : string
|
|
}
|
|
|
|
var a: { foo: string; }
|
|
>a : { foo: string; }
|
|
>foo : string
|
|
|
|
var b = { foo: '' };
|
|
>b : { foo: string; }
|
|
>{ foo: '' } : { foo: string; }
|
|
>foo : string
|
|
|
|
function foo1(x: A);
|
|
>foo1 : typeof foo1
|
|
>x : A
|
|
>A : A
|
|
|
|
function foo1(x: A); // error
|
|
>foo1 : typeof foo1
|
|
>x : A
|
|
>A : A
|
|
|
|
function foo1(x: any) { }
|
|
>foo1 : typeof foo1
|
|
>x : any
|
|
|
|
function foo1b(x: B);
|
|
>foo1b : typeof foo1b
|
|
>x : B
|
|
>B : B
|
|
|
|
function foo1b(x: B); // error
|
|
>foo1b : typeof foo1b
|
|
>x : B
|
|
>B : B
|
|
|
|
function foo1b(x: any) { }
|
|
>foo1b : typeof foo1b
|
|
>x : any
|
|
|
|
function foo1c(x: C<string>);
|
|
>foo1c : typeof foo1c
|
|
>x : C<string>
|
|
>C : C<T>
|
|
|
|
function foo1c(x: C<string>); // error
|
|
>foo1c : typeof foo1c
|
|
>x : C<string>
|
|
>C : C<T>
|
|
|
|
function foo1c(x: any) { }
|
|
>foo1c : typeof foo1c
|
|
>x : any
|
|
|
|
function foo2(x: I);
|
|
>foo2 : typeof foo2
|
|
>x : I
|
|
>I : I
|
|
|
|
function foo2(x: I); // error
|
|
>foo2 : typeof foo2
|
|
>x : I
|
|
>I : I
|
|
|
|
function foo2(x: any) { }
|
|
>foo2 : typeof foo2
|
|
>x : any
|
|
|
|
function foo3(x: typeof a);
|
|
>foo3 : typeof foo3
|
|
>x : { foo: string; }
|
|
>a : { foo: string; }
|
|
|
|
function foo3(x: typeof a); // error
|
|
>foo3 : typeof foo3
|
|
>x : { foo: string; }
|
|
>a : { foo: string; }
|
|
|
|
function foo3(x: any) { }
|
|
>foo3 : typeof foo3
|
|
>x : any
|
|
|
|
function foo4(x: typeof b);
|
|
>foo4 : typeof foo4
|
|
>x : { foo: string; }
|
|
>b : { foo: string; }
|
|
|
|
function foo4(x: typeof b); // error
|
|
>foo4 : typeof foo4
|
|
>x : { foo: string; }
|
|
>b : { foo: string; }
|
|
|
|
function foo4(x: any) { }
|
|
>foo4 : typeof foo4
|
|
>x : any
|
|
|
|
function foo5(x: A);
|
|
>foo5 : typeof foo5
|
|
>x : A
|
|
>A : A
|
|
|
|
function foo5(x: B); // error
|
|
>foo5 : typeof foo5
|
|
>x : B
|
|
>B : B
|
|
|
|
function foo5(x: any) { }
|
|
>foo5 : typeof foo5
|
|
>x : any
|
|
|
|
function foo5b(x: A);
|
|
>foo5b : typeof foo5b
|
|
>x : A
|
|
>A : A
|
|
|
|
function foo5b(x: C<string>); // error
|
|
>foo5b : typeof foo5b
|
|
>x : C<string>
|
|
>C : C<T>
|
|
|
|
function foo5b(x: any) { }
|
|
>foo5b : typeof foo5b
|
|
>x : any
|
|
|
|
function foo6(x: A);
|
|
>foo6 : typeof foo6
|
|
>x : A
|
|
>A : A
|
|
|
|
function foo6(x: I); // error
|
|
>foo6 : typeof foo6
|
|
>x : I
|
|
>I : I
|
|
|
|
function foo6(x: any) { }
|
|
>foo6 : typeof foo6
|
|
>x : any
|
|
|
|
function foo7(x: A);
|
|
>foo7 : typeof foo7
|
|
>x : A
|
|
>A : A
|
|
|
|
function foo7(x: typeof a); // error
|
|
>foo7 : typeof foo7
|
|
>x : { foo: string; }
|
|
>a : { foo: string; }
|
|
|
|
function foo7(x: any) { }
|
|
>foo7 : typeof foo7
|
|
>x : any
|
|
|
|
function foo8(x: B);
|
|
>foo8 : typeof foo8
|
|
>x : B
|
|
>B : B
|
|
|
|
function foo8(x: I); // error
|
|
>foo8 : typeof foo8
|
|
>x : I
|
|
>I : I
|
|
|
|
function foo8(x: any) { }
|
|
>foo8 : typeof foo8
|
|
>x : any
|
|
|
|
function foo9(x: B);
|
|
>foo9 : typeof foo9
|
|
>x : B
|
|
>B : B
|
|
|
|
function foo9(x: C<string>); // error
|
|
>foo9 : typeof foo9
|
|
>x : C<string>
|
|
>C : C<T>
|
|
|
|
function foo9(x: any) { }
|
|
>foo9 : typeof foo9
|
|
>x : any
|
|
|
|
function foo10(x: B);
|
|
>foo10 : typeof foo10
|
|
>x : B
|
|
>B : B
|
|
|
|
function foo10(x: typeof a); // error
|
|
>foo10 : typeof foo10
|
|
>x : { foo: string; }
|
|
>a : { foo: string; }
|
|
|
|
function foo10(x: any) { }
|
|
>foo10 : typeof foo10
|
|
>x : any
|
|
|
|
function foo11(x: B);
|
|
>foo11 : typeof foo11
|
|
>x : B
|
|
>B : B
|
|
|
|
function foo11(x: typeof b); // error
|
|
>foo11 : typeof foo11
|
|
>x : { foo: string; }
|
|
>b : { foo: string; }
|
|
|
|
function foo11(x: any) { }
|
|
>foo11 : typeof foo11
|
|
>x : any
|
|
|
|
function foo12(x: I);
|
|
>foo12 : typeof foo12
|
|
>x : I
|
|
>I : I
|
|
|
|
function foo12(x: C<string>); // error
|
|
>foo12 : typeof foo12
|
|
>x : C<string>
|
|
>C : C<T>
|
|
|
|
function foo12(x: any) { }
|
|
>foo12 : typeof foo12
|
|
>x : any
|
|
|
|
function foo13(x: I);
|
|
>foo13 : typeof foo13
|
|
>x : I
|
|
>I : I
|
|
|
|
function foo13(x: typeof a); // error
|
|
>foo13 : typeof foo13
|
|
>x : { foo: string; }
|
|
>a : { foo: string; }
|
|
|
|
function foo13(x: any) { }
|
|
>foo13 : typeof foo13
|
|
>x : any
|
|
|
|
function foo14(x: I);
|
|
>foo14 : typeof foo14
|
|
>x : I
|
|
>I : I
|
|
|
|
function foo14(x: typeof b); // error
|
|
>foo14 : typeof foo14
|
|
>x : { foo: string; }
|
|
>b : { foo: string; }
|
|
|
|
function foo14(x: any) { }
|
|
>foo14 : typeof foo14
|
|
>x : any
|
|
|