TypeScript/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.errors.txt
2014-07-12 17:30:19 -07:00

91 lines
2.6 KiB
Plaintext

==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts (12 errors) ====
// Specialized signatures must be a subtype of a non-specialized signature
// All the below should be errors
function foo(x: 'a');
~~~~~~~~~~~~~~~~~~~~~
!!! Specialized overload signature is not assignable to any non-specialized signature.
function foo(x: number) { }
class C {
foo(x: 'a');
~~~~~~~~~~~~
!!! Specialized overload signature is not assignable to any non-specialized signature.
foo(x: number);
foo(x: any) { }
}
class C2<T> {
foo(x: 'a');
~~~~~~~~~~~~
!!! Specialized overload signature is not assignable to any non-specialized signature.
foo(x: T);
foo(x: any) { }
}
class C3<T extends String> {
foo(x: 'a');
~~~~~~~~~~~~
!!! Specialized overload signature is not assignable to any non-specialized signature.
foo(x: T);
foo(x: any) { }
}
interface I {
(x: 'a');
~~~~~~~~~
!!! Specialized overload signature is not assignable to any non-specialized signature.
(x: number);
foo(x: 'a');
~~~~~~~~~~~~
!!! Specialized overload signature is not assignable to any non-specialized signature.
foo(x: number);
}
interface I2<T> {
(x: 'a');
~~~~~~~~~
!!! Specialized overload signature is not assignable to any non-specialized signature.
(x: T);
foo(x: 'a');
~~~~~~~~~~~~
!!! Specialized overload signature is not assignable to any non-specialized signature.
foo(x: T);
}
interface I3<T extends String> {
(x: 'a');
~~~~~~~~~
!!! Specialized overload signature is not assignable to any non-specialized signature.
(x: T);
foo(x: 'a');
~~~~~~~~~~~~
!!! Specialized overload signature is not assignable to any non-specialized signature.
foo(x: T);
}
var a: {
(x: 'a');
~~~~~~~~~
!!! Specialized overload signature is not assignable to any non-specialized signature.
(x: number);
foo(x: 'a');
~~~~~~~~~~~~
!!! Specialized overload signature is not assignable to any non-specialized signature.
foo(x: number);
}
var a2: {
(x: 'a');
<T>(x: T);
foo(x: 'a');
foo<T>(x: T);
}
var a3: {
(x: 'a');
<T>(x: T);
foo(x: 'a');
foo<T extends String>(x: T);
}