TypeScript/tests/baselines/reference/constructorsWithSpecializedSignatures.errors.txt
2014-09-11 16:11:08 -07:00

60 lines
2 KiB
Plaintext

==== tests/cases/compiler/constructorsWithSpecializedSignatures.ts (8 errors) ====
// errors
declare class C {
constructor(x: "hi");
~~~~~~~~~~~~~~~~~~~~~
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
constructor(x: "foo");
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
constructor(x: number);
}
// ok
declare class C2 {
constructor(x: "hi");
constructor(x: "foo");
constructor(x: string);
}
// errors
class D {
constructor(x: "hi");
~~~~~~~~~~~~~~~~~~~~~
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
constructor(x: "foo");
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
constructor(x: number);
constructor(x: "hi") { }
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2381: A signature with an implementation cannot use a string literal type.
}
// overloads are ok
class D2 {
constructor(x: "hi");
constructor(x: "foo");
constructor(x: string);
constructor(x: "hi") { } // error
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2381: A signature with an implementation cannot use a string literal type.
}
// errors
interface I {
new (x: "hi");
~~~~~~~~~~~~~~
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
new (x: "foo");
~~~~~~~~~~~~~~~
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
new (x: number);
}
// ok
interface I2 {
new (x: "hi");
new (x: "foo");
new (x: string);
}