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

40 lines
1.4 KiB
Plaintext

tests/cases/conformance/jsx/tsxAttributeErrors.tsx(15,6): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsx/tsxAttributeErrors.tsx(18,6): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/conformance/jsx/tsxAttributeErrors.tsx(22,6): error TS2606: Property 'text' of JSX spread attribute is not assignable to target property.
Type 'number' is not assignable to type 'string'.
==== tests/cases/conformance/jsx/tsxAttributeErrors.tsx (3 errors) ====
declare namespace JSX {
interface Element { }
interface IntrinsicElements {
div: {
text?: string;
width?: number;
}
span: any;
}
}
// Error, number is not assignable to string
<div text={42} />;
~~~~~~~~~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
// Error, string is not assignable to number
<div width={'foo'} />;
~~~~~~~~~~~~~
!!! error TS2322: Type 'string' is not assignable to type 'number'.
// Error, number is not assignable to string
var attribs = { text: 100 };
<div {...attribs} />;
~~~~~~~~~~~~
!!! error TS2606: Property 'text' of JSX spread attribute is not assignable to target property.
!!! error TS2606: Type 'number' is not assignable to type 'string'.
// No errors here
<span foo='bar' bar={'foo'} />;