// @filename: file.tsx // @jsx: preserve // @noLib: true // @skipLibCheck: true // @libFiles: react.d.ts,lib.d.ts import React = require('react'); function Greet(x: {name?: string}) { return
Hello, {x}
; } class BigGreeter extends React.Component<{ name?: string }, {}> { render() { return
; } greeting: string; } // OK let a = ; // OK - always valid to specify 'key' let b = ; // Error - not allowed to specify 'ref' on SFCs let c = ; // OK - ref is valid for classes let d = x.greeting.substr(10)} />; // Error ('subtr' not on string) let e = x.greeting.subtr(10)} />; // Error (ref callback is contextually typed) let f = x.notARealProperty} />; // OK - key is always valid let g = ; // OK - contextually typed intrinsic ref callback parameter let h =
x.innerText} />; // Error - property not on ontextually typed intrinsic ref callback parameter let i =
x.propertyNotOnHtmlDivElement} />;