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

30 lines
881 B
Plaintext

==== tests/cases/compiler/constructorOverloads1.ts (3 errors) ====
class Foo {
constructor(s: string);
constructor(n: number);
constructor(x: any) {
}
constructor(x: any) {
~~~~~~~~~~~~~~~~~~~~~
}
~~~~~
!!! error TS2392: Multiple constructor implementations are not allowed.
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'.
var f4 = new Foo([f1,f2,f3]);
~~~~~~~~~~
!!! error TS2345: Argument of type 'unknown[]' is not assignable to parameter of type 'number'.
f1.bar1();
f1.bar2();