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

46 lines
1.9 KiB
Plaintext
Raw Normal View History

2014-10-01 02:15:18 +02:00
tests/cases/compiler/constructorOverloads1.ts(2,5): error TS2392: Multiple constructor implementations are not allowed.
tests/cases/compiler/constructorOverloads1.ts(3,5): error TS2392: Multiple constructor implementations are not allowed.
tests/cases/compiler/constructorOverloads1.ts(4,5): error TS2392: Multiple constructor implementations are not allowed.
tests/cases/compiler/constructorOverloads1.ts(7,5): error TS2392: Multiple constructor implementations are not allowed.
tests/cases/compiler/constructorOverloads1.ts(16,18): error TS2345: Argument of type 'Foo' is not assignable to parameter of type 'number'.
tests/cases/compiler/constructorOverloads1.ts(17,18): error TS2345: Argument of type 'any[]' is not assignable to parameter of type 'number'.
2014-10-01 02:15:18 +02:00
==== tests/cases/compiler/constructorOverloads1.ts (6 errors) ====
2014-07-13 01:04:16 +02:00
class Foo {
constructor(s: string);
2014-10-01 02:15:18 +02:00
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2392: Multiple constructor implementations are not allowed.
2014-07-13 01:04:16 +02:00
constructor(n: number);
2014-10-01 02:15:18 +02:00
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2392: Multiple constructor implementations are not allowed.
2014-07-13 01:04:16 +02:00
constructor(x: any) {
2014-10-01 02:15:18 +02:00
~~~~~~~~~~~~~~~~~~~~~
2014-07-13 01:04:16 +02:00
}
2014-10-01 02:15:18 +02:00
~~~~~
!!! error TS2392: Multiple constructor implementations are not allowed.
2014-07-13 01:04:16 +02:00
constructor(x: any) {
~~~~~~~~~~~~~~~~~~~~~
}
~~~~~
!!! error TS2392: Multiple constructor implementations are not allowed.
2014-07-13 01:04:16 +02:00
bar1() { /*WScript.Echo("bar1");*/ }
bar2() { /*WScript.Echo("bar1");*/ }
}
var f1 = new Foo("hey");
var f2 = new Foo(0);
var f3 = new Foo(f1);
~~
!!! error TS2345: Argument of type 'Foo' is not assignable to parameter of type 'number'.
2014-07-13 01:04:16 +02:00
var f4 = new Foo([f1,f2,f3]);
~~~~~~~~~~
!!! error TS2345: Argument of type 'any[]' is not assignable to parameter of type 'number'.
2014-07-13 01:04:16 +02:00
f1.bar1();
f1.bar2();