mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-11 09:24:19 -06:00
Test cleanup
This commit is contained in:
parent
c58f7d57d3
commit
3426aa6644
@ -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} />;
|
||||
|
||||
|
||||
2
tests/lib/react.d.ts
vendored
2
tests/lib/react.d.ts
vendored
@ -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>;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user