TypeScript/tests/baselines/reference/tsxAttributeResolution3.errors.txt
2015-06-18 14:04:11 -07:00

59 lines
2.1 KiB
Plaintext

tests/cases/conformance/jsx/tsxAttributeResolution3.tsx(19,8): error TS2606: Property 'x' of JSX spread attribute is not assignable to target property.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsx/tsxAttributeResolution3.tsx(23,1): error TS2324: Property 'x' is missing in type 'Attribs1'.
tests/cases/conformance/jsx/tsxAttributeResolution3.tsx(31,15): error TS2606: Property 'x' of JSX spread attribute is not assignable to target property.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsx/tsxAttributeResolution3.tsx(39,8): error TS2322: Type 'number' is not assignable to type 'string'.
==== tests/cases/conformance/jsx/tsxAttributeResolution3.tsx (4 errors) ====
declare module JSX {
interface Element { }
interface IntrinsicElements {
test1: Attribs1;
}
}
interface Attribs1 {
x: string;
y?: number;
z?: string;
}
// OK
var obj1 = { x: 'foo' };
<test1 {...obj1} />
// Error, x is not string
var obj2 = { x: 32 };
<test1 {...obj2} />
~~~~~~~~~
!!! error TS2606: Property 'x' of JSX spread attribute is not assignable to target property.
!!! error TS2606: Type 'number' is not assignable to type 'string'.
// Error, x is missing
var obj3 = { y: 32 };
<test1 {...obj3} />
~~~~~~~~~~~~~~~~~~~
!!! error TS2324: Property 'x' is missing in type 'Attribs1'.
// OK
var obj4 = { x: 32, y: 32 };
<test1 {...obj4} x="ok" />
// Error
var obj5 = { x: 32, y: 32 };
<test1 x="ok" {...obj5} />
~~~~~~~~~
!!! error TS2606: Property 'x' of JSX spread attribute is not assignable to target property.
!!! error TS2606: Type 'number' is not assignable to type 'string'.
// OK
var obj6 = { x: 'ok', y: 32, extra: 100 };
<test1 {...obj6} />
// Error
var obj7 = { x: 'foo' };
<test1 x={32} {...obj7} />
~~~~~~
!!! error TS2322: Type 'number' is not assignable to type 'string'.