Support for spread operator on JSX element children

TypeScript 2.2 adds support for using spread on a JSX element children. Please see facebook/jsx#57 for more details.

Example

  1. function Todo(prop: { key: number, todo: string }) {
  2. return <div>{prop.key.toString() + prop.todo}</div>;
  3. }
  4. function TodoList({ todos }: TodoListProps) {
  5. return <div>
  6. {...todos.map(todo => <Todo key={todo.id} todo={todo.todo} />)}
  7. </div>;
  8. }
  9. let x: TodoListProps;
  10. <TodoList {...x} />