Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6211

React Native, TypeScript - Property 'includes', 'finds' does not exist on type 'any[]' no matter what configuration is setup

$
0
0

I have found this question asked in many many many places but not a single one of the answers has worked for me. My hunch is that it has something to do with me working in react-native but I am uncertain.

Basically I can't use es7 Array properties like find or includes without my linter claiming there is an error. There isn't one (the react-native Javascript environment includes this properties) but no matter what I do I can't remove the error.

The bulk of responses to this issue center around altering tsconfig.json, specifically the lib or target properties.

My current tsconfig.json is:

{
  "compilerOptions": {
    "allowJs": true,
    "target": "esnext",
    "outDir": "dist",
    "module": "commonjs",
    "sourceMap": true,
    "lib": ["es2016.array.include"],
    "jsx": "react-native",
    "strict": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true
  }
}

Based on the documentation es2016.array.include is a valid value for the lib property but I still see the error Property includes does not exist on type any[].

I have tried setting target to es2015, es2016, es2017, es2018, es5, es6, and esnext. I have tried adding various things to my lib param including es6, es6, es7, dom, es2016, es2017, es2018, esnext, and the specific properties like es2106.array.includes but none of these values or any combination remove this error from my linter.


Viewing all articles
Browse latest Browse all 6211

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>