TypeScript/tests/baselines/reference/tsxAttributeResolution2.js
2015-06-18 14:04:11 -07:00

27 lines
594 B
TypeScript

//// [tsxAttributeResolution2.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements {
test1: Attribs1;
}
}
interface Attribs1 {
c1?: (x: string) => void;
}
// OK
<test1 c1={(x) => x.length} />; // OK
<test1 data-c1={(x) => x.leng} />; // OK
// Errors
<test1 c1={(x) => x.leng} />; // Error, no leng on 'string'
//// [tsxAttributeResolution2.jsx]
// OK
<test1 c1={function (x) { return x.length; }}/>; // OK
<test1 data-c1={function (x) { return x.leng; }}/>; // OK
// Errors
<test1 c1={function (x) { return x.leng; }}/>; // Error, no leng on 'string'