Check out example codes for "property 'length' does not exist on type 'T'". It will help you in understanding the concepts better.

Code Example 1

const result = <T extends any>(arr:T[]):T => {
  return arr[arr.length - 1] 
}

result([1,2,3])

Learn ReactJs, React Native from akashmittal.com