mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
76 lines
2.7 KiB
Plaintext
76 lines
2.7 KiB
Plaintext
classWithConstructors.ts(6,13): error TS2554: Expected 1 arguments, but got 0.
|
|
classWithConstructors.ts(15,14): error TS2554: Expected 1 arguments, but got 0.
|
|
classWithConstructors.ts(21,13): error TS2554: Expected 1 arguments, but got 0.
|
|
classWithConstructors.ts(31,13): error TS2554: Expected 1 arguments, but got 0.
|
|
classWithConstructors.ts(40,14): error TS2554: Expected 1-2 arguments, but got 0.
|
|
classWithConstructors.ts(46,13): error TS2554: Expected 1-2 arguments, but got 0.
|
|
|
|
|
|
==== classWithConstructors.ts (6 errors) ====
|
|
namespace NonGeneric {
|
|
class C {
|
|
constructor(x: string) { }
|
|
}
|
|
|
|
var c = new C(); // error
|
|
~~~~~~~
|
|
!!! error TS2554: Expected 1 arguments, but got 0.
|
|
!!! related TS6210 classWithConstructors.ts:3:21: An argument for 'x' was not provided.
|
|
var c2 = new C(''); // ok
|
|
|
|
class C2 {
|
|
constructor(x: number);
|
|
constructor(x: string);
|
|
constructor(x: any) { }
|
|
}
|
|
|
|
var c3 = new C2(); // error
|
|
~~~~~~~~
|
|
!!! error TS2554: Expected 1 arguments, but got 0.
|
|
!!! related TS6210 classWithConstructors.ts:10:21: An argument for 'x' was not provided.
|
|
var c4 = new C2(''); // ok
|
|
var c5 = new C2(1); // ok
|
|
|
|
class D extends C2 { }
|
|
|
|
var d = new D(); // error
|
|
~~~~~~~
|
|
!!! error TS2554: Expected 1 arguments, but got 0.
|
|
!!! related TS6210 classWithConstructors.ts:10:21: An argument for 'x' was not provided.
|
|
var d2 = new D(1); // ok
|
|
var d3 = new D(''); // ok
|
|
}
|
|
|
|
namespace Generics {
|
|
class C<T> {
|
|
constructor(x: T) { }
|
|
}
|
|
|
|
var c = new C(); // error
|
|
~~~~~~~
|
|
!!! error TS2554: Expected 1 arguments, but got 0.
|
|
!!! related TS6210 classWithConstructors.ts:28:21: An argument for 'x' was not provided.
|
|
var c2 = new C(''); // ok
|
|
|
|
class C2<T,U> {
|
|
constructor(x: T);
|
|
constructor(x: T, y: U);
|
|
constructor(x: any) { }
|
|
}
|
|
|
|
var c3 = new C2(); // error
|
|
~~~~~~~~
|
|
!!! error TS2554: Expected 1-2 arguments, but got 0.
|
|
!!! related TS6210 classWithConstructors.ts:35:21: An argument for 'x' was not provided.
|
|
var c4 = new C2(''); // ok
|
|
var c5 = new C2(1, 2); // ok
|
|
|
|
class D<T, U> extends C2<T, U> { }
|
|
|
|
var d = new D(); // error
|
|
~~~~~~~
|
|
!!! error TS2554: Expected 1-2 arguments, but got 0.
|
|
!!! related TS6210 classWithConstructors.ts:35:21: An argument for 'x' was not provided.
|
|
var d2 = new D(1); // ok
|
|
var d3 = new D(''); // ok
|
|
} |