Files
tsgo/testdata/baselines/reference/submodule/conformance/destructuringParameterDeclaration5.errors.txt

79 lines
3.4 KiB
Plaintext

destructuringParameterDeclaration5.ts(9,5): error TS2564: Property 'foo' has no initializer and is not definitely assigned in the constructor.
destructuringParameterDeclaration5.ts(14,5): error TS2564: Property 'foo' has no initializer and is not definitely assigned in the constructor.
destructuringParameterDeclaration5.ts(19,5): error TS2564: Property 'bar' has no initializer and is not definitely assigned in the constructor.
destructuringParameterDeclaration5.ts(47,6): error TS2741: Property 'foo' is missing in type 'Class' but required in type 'D'.
destructuringParameterDeclaration5.ts(48,4): error TS2741: Property 'y' is missing in type '{}' but required in type '{ y: D; }'.
destructuringParameterDeclaration5.ts(49,6): error TS2322: Type 'number' is not assignable to type 'D'.
destructuringParameterDeclaration5.ts(50,6): error TS2322: Type 'string' is not assignable to type 'D'.
==== destructuringParameterDeclaration5.ts (7 errors) ====
// Parameter Declaration with generic
interface F { }
class Class implements F {
constructor() { }
}
class SubClass extends Class {
foo: boolean;
~~~
!!! error TS2564: Property 'foo' has no initializer and is not definitely assigned in the constructor.
constructor() { super(); }
}
class D implements F {
foo: boolean
~~~
!!! error TS2564: Property 'foo' has no initializer and is not definitely assigned in the constructor.
constructor() { }
}
class SubD extends D {
bar: number
~~~
!!! error TS2564: Property 'bar' has no initializer and is not definitely assigned in the constructor.
constructor() {
super();
}
}
function d0<T extends Class>({x} = { x: new Class() }) { }
function d1<T extends F>({x}: { x: F }) { }
function d2<T extends Class>({x}: { x: Class }) { }
function d3<T extends D>({y}: { y: D }) { }
function d4<T extends D>({y} = { y: new D() }) { }
var obj = new Class();
d0({ x: 1 });
d0({ x: {} });
d0({ x: "string" });
d1({ x: new Class() });
d1({ x: {} });
d1({ x: "string" });
d2({ x: new SubClass() });
d2({ x: {} });
d3({ y: new SubD() });
d3({ y: new SubClass() });
// Error
d3({ y: new Class() });
~
!!! error TS2741: Property 'foo' is missing in type 'Class' but required in type 'D'.
!!! related TS2728 destructuringParameterDeclaration5.ts:14:5: 'foo' is declared here.
!!! related TS6500 destructuringParameterDeclaration5.ts:29:33: The expected type comes from property 'y' which is declared here on type '{ y: D; }'
d3({});
~~
!!! error TS2741: Property 'y' is missing in type '{}' but required in type '{ y: D; }'.
!!! related TS2728 destructuringParameterDeclaration5.ts:29:33: 'y' is declared here.
d3({ y: 1 });
~
!!! error TS2322: Type 'number' is not assignable to type 'D'.
!!! related TS6500 destructuringParameterDeclaration5.ts:29:33: The expected type comes from property 'y' which is declared here on type '{ y: D; }'
d3({ y: "world" });
~
!!! error TS2322: Type 'string' is not assignable to type 'D'.
!!! related TS6500 destructuringParameterDeclaration5.ts:29:33: The expected type comes from property 'y' which is declared here on type '{ y: D; }'