TypeScript/tests/baselines/reference/overloadOnConstNoAnyImplementation2.errors.txt

39 lines
2.1 KiB
Plaintext
Raw Normal View History

tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(2,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(6,29): error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(12,18): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(17,9): error TS2381: A signature with an implementation cannot use a string literal type.
tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts(18,9): error TS2381: A signature with an implementation cannot use a string literal type.
2014-07-13 01:04:16 +02:00
==== tests/cases/compiler/overloadOnConstNoAnyImplementation2.ts (5 errors) ====
interface I {
x1(a: number, callback: (x: 'hi') => number);
~~~~~~~~~~~~~~~~~~~
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
2014-07-13 01:04:16 +02:00
}
class C {
x1(a: number, callback: (x: 'hi') => number);
~~~~~~~~~~~~~~~~~~~
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
2014-07-13 01:04:16 +02:00
x1(a: number, callback: (x: string) => number) {
callback('hi');
callback('bye');
var hm = "hm";
callback(hm);
callback(1); // error
~
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
2014-07-13 01:04:16 +02:00
}
}
var c: C;
c.x1(1, (x: 'hi') => { return 1; } );
~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2381: A signature with an implementation cannot use a string literal type.
2014-07-13 01:04:16 +02:00
c.x1(1, (x: 'bye') => { return 1; } );
~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2381: A signature with an implementation cannot use a string literal type.
2014-07-13 01:04:16 +02:00
c.x1(1, (x) => { return 1; } );
c.x1(1, (x: number) => { return 1; } );