title: How to add TYPE to Object.assign using Typescript
body: <p>I have an array of typed objects - all objects are of type: TodoModel. When I filter them, to adjust the content on the UI, you have to create a new array and adjust the properties on the item that was changed for the filter to refilter in angular2. When I create the new array and add the changed object, the object is of no type, while the other 2 objects in the array are still of type: TodoModel. I can't figure out how to assign a type to the new object :( Thanks in advance for any help!</p>
  
  <p>Here is the code for the logic &amp; below I have a screen shot of the before and after for the mutated arrays:</p>
  
  <pre><code>case 'TOGGLE_TODO':
  
          const todo: ITodoModel = payload;
  
          const i = state.indexOf(todo);
  
          const status = todo.status == "started" ? "completed" : "started";
  
          const toggledTodo:ITodoModel = Object.assign(&lt;ITodoModel&gt;{}, todo, {status});
  
          state = [
              //... = spread operator - bascially loops through the array
              ...state.slice(0,i), // check items before
              toggledTodo, // clicked item
              ...state.slice(i + 1) // check items after
          ];
  
          console.log('toggle state');
          console.log(state);
  
  return state;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/clxER.png" alt="Picture of a Before and after array mutation"></p>