1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
|
//// [tests/cases/conformance/jsx/tsxSpreadAttributesResolution11.tsx] ////
=== file.tsx ===
import React = require('react');
>React : typeof React
const obj = {};
>obj : {}
>{} : {}
const obj1: { x: 2 } = {
>obj1 : { x: 2; }
>x : 2
>{ x: 2} : { x: 2; }
x: 2
>x : 2
>2 : 2
}
const obj3: {y: true, overwrite: string } = {
>obj3 : { y: true; overwrite: string; }
>y : true
>true : true
>overwrite : string
>{ y: true, overwrite: "hi"} : { y: true; overwrite: string; }
y: true,
>y : true
>true : true
overwrite: "hi"
>overwrite : string
>"hi" : "hi"
}
interface Prop {
x: 2
>x : 2
y: true
>y : true
>true : true
overwrite: string
>overwrite : string
}
class OverWriteAttr extends React.Component<Prop, {}> {
>OverWriteAttr : OverWriteAttr
>React.Component : React.Component<Prop, {}>
>React : typeof React
>Component : typeof React.Component
render() {
>render : () => JSX.Element
return <div>Hello</div>;
><div>Hello</div> : JSX.Element
>div : any
>div : any
}
}
let anyobj: any;
>anyobj : any
// OK
let x = <OverWriteAttr {...obj} y overwrite="hi" {...obj1} />
>x : JSX.Element
><OverWriteAttr {...obj} y overwrite="hi" {...obj1} /> : JSX.Element
>OverWriteAttr : typeof OverWriteAttr
>obj : {}
>y : true
>overwrite : string
>obj1 : { x: 2; }
let x1 = <OverWriteAttr {...obj1} {...obj3} />
>x1 : JSX.Element
><OverWriteAttr {...obj1} {...obj3} /> : JSX.Element
>OverWriteAttr : typeof OverWriteAttr
>obj1 : { x: 2; }
>obj3 : { y: true; overwrite: string; }
let x2 = <OverWriteAttr x={3} overwrite="hi" {...obj1} {...{y: true}} />
>x2 : JSX.Element
><OverWriteAttr x={3} overwrite="hi" {...obj1} {...{y: true}} /> : JSX.Element
>OverWriteAttr : typeof OverWriteAttr
>x : 3
>3 : 3
>overwrite : string
>obj1 : { x: 2; }
>{y: true} : { y: true; }
>y : true
>true : true
let x3 = <OverWriteAttr overwrite="hi" {...obj1} x={3} {...{y: true, x: 2, overwrite:"world"}} />
>x3 : JSX.Element
><OverWriteAttr overwrite="hi" {...obj1} x={3} {...{y: true, x: 2, overwrite:"world"}} /> : JSX.Element
>OverWriteAttr : typeof OverWriteAttr
>overwrite : string
>obj1 : { x: 2; }
>x : 3
>3 : 3
>{y: true, x: 2, overwrite:"world"} : { y: true; x: 2; overwrite: string; }
>y : true
>true : true
>x : 2
>2 : 2
>overwrite : string
>"world" : "world"
let x4 = <OverWriteAttr {...{x: 2}} {...{overwrite: "world"}} {...{y: true}} />
>x4 : JSX.Element
><OverWriteAttr {...{x: 2}} {...{overwrite: "world"}} {...{y: true}} /> : JSX.Element
>OverWriteAttr : typeof OverWriteAttr
>{x: 2} : { x: 2; }
>x : 2
>2 : 2
>{overwrite: "world"} : { overwrite: string; }
>overwrite : string
>"world" : "world"
>{y: true} : { y: true; }
>y : true
>true : true
let x5 = <OverWriteAttr {...anyobj} />
>x5 : JSX.Element
><OverWriteAttr {...anyobj} /> : JSX.Element
>OverWriteAttr : typeof OverWriteAttr
>anyobj : any
|