2014-08-06 22:39:09 +02:00
|
|
|
//// [inheritedOverloadedSpecializedSignatures.ts]
|
|
|
|
interface A {
|
|
|
|
(key:string):void;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface B extends A {
|
|
|
|
(key:'foo'):string;
|
|
|
|
}
|
|
|
|
|
|
|
|
var b:B;
|
|
|
|
// Should not error
|
|
|
|
b('foo').charAt(0);
|
|
|
|
|
|
|
|
interface A {
|
|
|
|
(x: 'A1'): string;
|
|
|
|
(x: string): void;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface B extends A {
|
|
|
|
(x: 'B1'): number;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface A {
|
|
|
|
(x: 'A2'): boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface B {
|
|
|
|
(x: 'B2'): string[];
|
|
|
|
}
|
|
|
|
|
|
|
|
var b: B;
|
|
|
|
// non of these lines should error
|
|
|
|
var x1: string[] = b('B2');
|
|
|
|
var x2: number = b('B1');
|
|
|
|
var x3: boolean = b('A2');
|
|
|
|
var x4: string = b('A1');
|
|
|
|
var x5: void = b('A0');
|
|
|
|
|
|
|
|
//// [inheritedOverloadedSpecializedSignatures.js]
|
|
|
|
var b;
|
2014-08-16 00:49:09 +02:00
|
|
|
// Should not error
|
2014-08-06 22:39:09 +02:00
|
|
|
b('foo').charAt(0);
|
|
|
|
var b;
|
2014-08-12 00:54:12 +02:00
|
|
|
// non of these lines should error
|
2014-08-06 22:39:09 +02:00
|
|
|
var x1 = b('B2');
|
|
|
|
var x2 = b('B1');
|
|
|
|
var x3 = b('A2');
|
|
|
|
var x4 = b('A1');
|
|
|
|
var x5 = b('A0');
|