42 lines
No EOL
2 KiB
Text
42 lines
No EOL
2 KiB
Text
tests/cases/compiler/overloadingOnConstants2.ts(8,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
|
tests/cases/compiler/overloadingOnConstants2.ts(9,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
|
tests/cases/compiler/overloadingOnConstants2.ts(15,13): error TS2345: Argument of type 'string' is not assignable to parameter of type '"bye"'.
|
|
tests/cases/compiler/overloadingOnConstants2.ts(19,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
|
|
|
|
|
==== tests/cases/compiler/overloadingOnConstants2.ts (4 errors) ====
|
|
class C {
|
|
private x = 1;
|
|
}
|
|
class D extends C {}
|
|
class E {
|
|
private y = 1;
|
|
}
|
|
function foo(x: "hi", items: string[]): D;
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
|
function foo(x: "bye", items: string[]): E;
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
|
function foo(x: string, items: string[]): C {
|
|
return null;
|
|
}
|
|
var a: D = foo("hi", []); // D
|
|
var b: E = foo("bye", []); // E
|
|
var c = foo("um", []); // error
|
|
~~~~
|
|
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"bye"'.
|
|
|
|
|
|
//function bar(x: "hi", items: string[]): D;
|
|
function bar(x: "bye", items: string[]): E;
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
|
|
function bar(x: string, items: string[]): C;
|
|
function bar(x: string, items: string[]): C {
|
|
return null;
|
|
}
|
|
|
|
var d: D = bar("hi", []); // D
|
|
var e: E = bar("bye", []); // E
|
|
var f: C = bar("um", []); // C |