Test cleanup

This commit is contained in:
Ryan Cavanaugh 2015-11-10 12:59:47 -08:00
parent c58f7d57d3
commit 3426aa6644
2 changed files with 14 additions and 8 deletions

View File

@ -18,18 +18,24 @@ class BigGreeter extends React.Component<{ name?: string }, {}> {
// OK
let a = <Greet />;
// OK
// OK - always valid to specify 'key'
let b = <Greet key="k" />;
// Error
// Error - not allowed to specify 'ref' on SFCs
let c = <Greet ref="myRef" />;
// OK
// OK - ref is valid for classes
let d = <BigGreeter ref={x => x.greeting.substr(10)} />;
// Error ('subtr')
// Error ('subtr' not on string)
let e = <BigGreeter ref={x => x.greeting.subtr(10)} />;
// Error
// Error (ref callback is contextually typed)
let f = <BigGreeter ref={x => x.notARealProperty} />;
// OK
let f = <BigGreeter key={100} />;
// OK - key is always valid
let g = <BigGreeter key={100} />;
// OK - contextually typed intrinsic ref callback parameter
let h = <div ref={x => x.innerText} />;
// Error - property not on ontextually typed intrinsic ref callback parameter
let i = <div ref={x => x.propertyNotOnHtmlDivElement} />;

View File

@ -1947,7 +1947,7 @@ declare namespace JSX {
details: React.HTMLElementAttributes<HTMLElement>;
dfn: React.HTMLElementAttributes<HTMLElement>;
dialog: React.HTMLElementAttributes<HTMLElement>;
div: React.HTMLElementAttributes<HTMLElement>;
div: React.HTMLElementAttributes<HTMLDivElement>;
dl: React.HTMLElementAttributes<HTMLDListElement>;
dt: React.HTMLElementAttributes<HTMLElement>;
em: React.HTMLElementAttributes<HTMLElement>;