title: Property 'id' does not exist on type 'T'.(2339) Typescript Generics error
body: <p>I have a function called <code>updateArrayOfObjects</code> which updates the object in the array. I am passing a generic type to this function like below: </p>
  
  <pre><code>interface OtherIncomeSource {
    id?: string;
    incomeDescription?: string;
    amount?: number;
  }
  
  const otherIncomes = [
            {
              id: "#6523-3244-3423-4343",
              incomeDescription: "Rent",
              amount: 100
            },
            {
              id: "#6523-3244-3423-4343",
              incomeDescription: "Commercial",
              amount: undefined
      }
  ]
  
  const updateArrayOfObjects = &lt;T&gt;(arrayOfObjects: T[], newObject: T, deleteObject: boolean = false): T[] =&gt; {
      const newArrayOfObjects = arrayOfObjects.slice();
  
    let index = newArrayOfObjects.findIndex((obj: T) =&gt; obj.id === newObject.id)
    if(deleteObject) {
      newArrayOfObjects.splice(index, 1);
    } else {
      if (index === -1) {
        newArrayOfObjects.push(newObject);
      } else {
        newArrayOfObjects[index] = newObject;
      }
    }
  
    return newArrayOfObjects
  }
  
  const newData = updateArrayOfObjects&lt;OtherIncomeSource&gt;(otherIncomes, {id: '1233', incomeDescription: 'agri', amount: 5000})
  </code></pre>
  
  <p>I am getting an error at the below mentioned line when accessing <code>id</code>saying "Property 'id' does not exist on type 'T'.(2339)":</p>
  
  <pre><code>let index = newArrayOfObjects.findIndex((obj: T) =&gt; obj.id === newObject.id)
  </code></pre>
  
  <p>Below is the typescript playground link for a complete environment of this issue and in here the error is highlighted in red: <a href="https://www.typescriptlang.org/play/?ssl=2&amp;ssc=1&amp;pln=39&amp;pc=1#code/FASwdgLgpgTgZgQwMZQAQHkIAtYEkxID2AtlAMqECuMKqA3sKqiACYD8AXKgM4QzgBzANyNmBElAAiUbkn4AHCCEJhOPPoJFMExKpDVhKxAEawRAX2DAiYXqkLY840t1QBeVAG1RTX74Z+gb6sXABEAMQAbACsAEwAzAC08bEALKnJqQmJqfG5oQA0PkHBzlIyciCKymBhAEpQkIXFJag6ehBcAIwADD0tgeZFrUwBI0whqBEx2Snpmdm5+cPjYkSk0rIKSiphAMIkpDQgCAA2zattupSQXDcsUHDgUCzFlgC6VjZ2lPIsCNAAIIwGAIACe6Dg6GMACsoEgIK4PAAeAAqAD4ABQIEHgyHQuEI7hcVGed4FVBgKAAdwJ8M6qFRFIepyg0DpCK4xkIhFZCDA7lQiFO3CgAEoSWT3Oj6MVvhBKTTgaCIVDYfSkW1caqOYiAHTcU4gFCYsVaVCiVkK8APAAegqp1OVeLVhP1TzALHwdsxmMIsJJYul9lhetY7jcHkdurDLDFohAcExLLZUF1QbGTEdzp16qJBvkRpNNqgtopXTNonMqCgIrQmeYcFQmJL9sjHkSFdlQWz2vxef18ko3CwmOjA8rfmrtdF3cCvZV-bd3E8rfeDppuvNTEsO6sTBgbOoAoXLt13GAlmsKjsjskAIQgt+-yBfddGuRmBwMHw63IVBoKAsQcb9fwkbgKToSYAHIugSeJoIpcA-02Spql2VBoIQAR+EQq4Oi4aI+h6cx4yAA" rel="noreferrer">Example in Typescript Playground</a></p>