mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
71 lines
2.9 KiB
Plaintext
71 lines
2.9 KiB
Plaintext
classWithBaseClassButNoConstructor.ts(6,5): error TS2564: Property 'foo' has no initializer and is not definitely assigned in the constructor.
|
|
classWithBaseClassButNoConstructor.ts(10,9): error TS2554: Expected 1 arguments, but got 0.
|
|
classWithBaseClassButNoConstructor.ts(18,5): error TS2564: Property 'foo' has no initializer and is not definitely assigned in the constructor.
|
|
classWithBaseClassButNoConstructor.ts(22,9): error TS2554: Expected 1 arguments, but got 0.
|
|
classWithBaseClassButNoConstructor.ts(27,5): error TS2564: Property 'foo' has no initializer and is not definitely assigned in the constructor.
|
|
classWithBaseClassButNoConstructor.ts(31,10): error TS2554: Expected 1 arguments, but got 0.
|
|
classWithBaseClassButNoConstructor.ts(35,5): error TS2564: Property 'foo' has no initializer and is not definitely assigned in the constructor.
|
|
classWithBaseClassButNoConstructor.ts(39,10): error TS2554: Expected 1 arguments, but got 0.
|
|
|
|
|
|
==== classWithBaseClassButNoConstructor.ts (8 errors) ====
|
|
class Base {
|
|
constructor(x: number) { }
|
|
}
|
|
|
|
class C extends Base {
|
|
foo: string;
|
|
~~~
|
|
!!! error TS2564: Property 'foo' has no initializer and is not definitely assigned in the constructor.
|
|
}
|
|
|
|
var r = C;
|
|
var c = new C(); // error
|
|
~~~~~~~
|
|
!!! error TS2554: Expected 1 arguments, but got 0.
|
|
!!! related TS6210 classWithBaseClassButNoConstructor.ts:2:17: An argument for 'x' was not provided.
|
|
var c2 = new C(1); // ok
|
|
|
|
class Base2<T,U> {
|
|
constructor(x: T) { }
|
|
}
|
|
|
|
class D<T,U> extends Base2<T,U> {
|
|
foo: U;
|
|
~~~
|
|
!!! error TS2564: Property 'foo' has no initializer and is not definitely assigned in the constructor.
|
|
}
|
|
|
|
var r2 = D;
|
|
var d = new D(); // error
|
|
~~~~~~~
|
|
!!! error TS2554: Expected 1 arguments, but got 0.
|
|
!!! related TS6210 classWithBaseClassButNoConstructor.ts:14:17: An argument for 'x' was not provided.
|
|
var d2 = new D(1); // ok
|
|
|
|
// specialized base class
|
|
class D2<T, U> extends Base2<string, number> {
|
|
foo: U;
|
|
~~~
|
|
!!! error TS2564: Property 'foo' has no initializer and is not definitely assigned in the constructor.
|
|
}
|
|
|
|
var r3 = D2;
|
|
var d3 = new D(); // error
|
|
~~~~~~~
|
|
!!! error TS2554: Expected 1 arguments, but got 0.
|
|
!!! related TS6210 classWithBaseClassButNoConstructor.ts:14:17: An argument for 'x' was not provided.
|
|
var d4 = new D(1); // ok
|
|
|
|
class D3 extends Base2<string, number> {
|
|
foo: string;
|
|
~~~
|
|
!!! error TS2564: Property 'foo' has no initializer and is not definitely assigned in the constructor.
|
|
}
|
|
|
|
var r4 = D3;
|
|
var d5 = new D(); // error
|
|
~~~~~~~
|
|
!!! error TS2554: Expected 1 arguments, but got 0.
|
|
!!! related TS6210 classWithBaseClassButNoConstructor.ts:14:17: An argument for 'x' was not provided.
|
|
var d6 = new D(1); // ok |