From this question and the accepted answer, I know that there is an methode to check if an array includes an object in JavaScript by using this line of code:
> ['joe', 'jane', 'mary'].includes('jane'); true
However if I use the same code in TypeScript I've got this error:
Property
includes
does not exist on typestring[]
.
- Why gives the compiler this error? I'm expecting that everything that is available in JS, is available in TS.
- How could I solve this error without changing the code? It must be working on ES5.