1//// [file.tsx] 2import React = require('react') 3 4declare function Component<U>(l: U): JSX.Element; 5function createComponent<T extends { prop: number }>(arg: T) { 6 let a1 = <Component {...arg} />; 7 let a2 = <Component {...arg} prop1 />; 8} 9 10declare function ComponentSpecific<U>(l: { prop: U }): JSX.Element; 11declare function ComponentSpecific1<U>(l: { prop: U, "ignore-prop": number }): JSX.Element; 12 13function Bar<T extends { prop: number }>(arg: T) { 14 let a1 = <ComponentSpecific {...arg} ignore-prop="hi" />; // U is number 15 let a2 = <ComponentSpecific1 {...arg} ignore-prop={10} />; // U is number 16 let a3 = <ComponentSpecific {...arg} prop="hello" />; // U is "hello" 17 let a4 = <ComponentSpecific {...arg} prop1="hello" />; // U is "hello" 18} 19 20 21//// [file.jsx] 22define(["require", "exports", "react"], function (require, exports, React) { 23 "use strict"; 24 exports.__esModule = true; 25 function createComponent(arg) { 26 var a1 = <Component {...arg}/>; 27 var a2 = <Component {...arg} prop1/>; 28 } 29 function Bar(arg) { 30 var a1 = <ComponentSpecific {...arg} ignore-prop="hi"/>; // U is number 31 var a2 = <ComponentSpecific1 {...arg} ignore-prop={10}/>; // U is number 32 var a3 = <ComponentSpecific {...arg} prop="hello"/>; // U is "hello" 33 var a4 = <ComponentSpecific {...arg} prop1="hello"/>; // U is "hello" 34 } 35}); 36