//// [tsxSpreadChildrenInvalidType.tsx]
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
{prop.key.toString() + prop.todo}
;
}
function TodoList({ todos }: TodoListProps) {
return
{...}
;
}
function TodoListNoError({ todos }: TodoListProps) {
// any is not checked
return
{...( as any)}
;
}
let x: TodoListProps;
//// [tsxSpreadChildrenInvalidType.js]
function Todo(prop) {
return React.createElement("div", null, prop.key.toString() + prop.todo);
}
function TodoList({ todos }) {
return React.createElement("div", null, ...React.createElement(Todo, { key: todos[0].id, todo: todos[0].todo }));
}
function TodoListNoError({ todos }) {
// any is not checked
return React.createElement("div", null, ...React.createElement(Todo, { key: todos[0].id, todo: todos[0].todo }));
}
let x;
React.createElement(TodoList, Object.assign({}, x));