TypeScript/tests/baselines/reference/inheritedOverloadedSpecializedSignatures.types
2014-08-15 14:37:48 -07:00

91 lines
1.1 KiB
Plaintext

=== tests/cases/compiler/inheritedOverloadedSpecializedSignatures.ts ===
interface A {
>A : A
(key:string):void;
>key : string
}
interface B extends A {
>B : B
>A : A
(key:'foo'):string;
>key : 'foo'
}
var b:B;
>b : B
>B : B
// Should not error
b('foo').charAt(0);
>b('foo').charAt(0) : string
>b('foo').charAt : (pos: number) => string
>b('foo') : string
>b : B
>charAt : (pos: number) => string
interface A {
>A : A
(x: 'A1'): string;
>x : 'A1'
(x: string): void;
>x : string
}
interface B extends A {
>B : B
>A : A
(x: 'B1'): number;
>x : 'B1'
}
interface A {
>A : A
(x: 'A2'): boolean;
>x : 'A2'
}
interface B {
>B : B
(x: 'B2'): string[];
>x : 'B2'
}
var b: B;
>b : B
>B : B
// non of these lines should error
var x1: string[] = b('B2');
>x1 : string[]
>b('B2') : string[]
>b : B
var x2: number = b('B1');
>x2 : number
>b('B1') : number
>b : B
var x3: boolean = b('A2');
>x3 : boolean
>b('A2') : boolean
>b : B
var x4: string = b('A1');
>x4 : string
>b('A1') : string
>b : B
var x5: void = b('A0');
>x5 : void
>b('A0') : void
>b : B