TypeScript/tests/cases/conformance/jsx/tsxSpreadChildren.tsx
Nathan Shively-Sanders d29c78e718 Add spread syntax tests for JsxExpressions
And baselines
2016-10-13 09:28:39 -07:00

28 lines
556 B
TypeScript

//@jsx: preserve
declare module JSX {
interface Element { }
interface IntrinsicElements {
[s: string]: any;
}
}
declare var React: any;
interface TodoProp {
id: number;
todo: string;
}
interface TodoListProps {
todos: TodoProp[];
}
function Todo(prop: { key: number, todo: string }) {
return <div>{prop.key.toString() + prop.todo}</div>;
}
function TodoList({ todos }: TodoListProps) {
return <div>
{...todos.map(todo => <Todo key={todo.id} todo={todo.todo}/>)}
</div>;
}
let x: TodoListProps;
<TodoList {...x}/>