mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
29 lines
1.0 KiB
Plaintext
29 lines
1.0 KiB
Plaintext
classWithoutExplicitConstructor.ts(7,16): error TS2554: Expected 0 arguments, but got 1.
|
|
classWithoutExplicitConstructor.ts(11,5): error TS2322: Type 'null' is not assignable to type 'T'.
|
|
'T' could be instantiated with an arbitrary type which could be unrelated to 'null'.
|
|
classWithoutExplicitConstructor.ts(15,16): error TS2554: Expected 0 arguments, but got 1.
|
|
|
|
|
|
==== classWithoutExplicitConstructor.ts (3 errors) ====
|
|
class C {
|
|
x = 1
|
|
y = 'hello';
|
|
}
|
|
|
|
var c = new C();
|
|
var c2 = new C(null); // error
|
|
~~~~
|
|
!!! error TS2554: Expected 0 arguments, but got 1.
|
|
|
|
class D<T extends Date> {
|
|
x = 2
|
|
y: T = null;
|
|
~
|
|
!!! error TS2322: Type 'null' is not assignable to type 'T'.
|
|
!!! error TS2322: 'T' could be instantiated with an arbitrary type which could be unrelated to 'null'.
|
|
}
|
|
|
|
var d = new D();
|
|
var d2 = new D(null); // error
|
|
~~~~
|
|
!!! error TS2554: Expected 0 arguments, but got 1. |