I'm new to the world of typeScript, hence I'm having some configuration issues. The problem is that some methods are not working even though they theoretically should. Currently my typeScript config looks as follows:
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"noEmitOnError": true,
"strictNullChecks": true,
"lib": [
"dom",
"ES2015.Collection",
"ES2015.Iterable",
"ES2016.Array.include",
"ES2017.Object",
"ES5",
"ES6",
],
}
}
Everything seems to be fine besides the fact that when I try to use for example Number.isInteger() method or Array.entries() method following error occurs:
Property 'isInteger' does not exist on type 'NumberConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
The same happens with .entries(). Can anyone help?
The following is from the Typescript playground. If you follow the link and toggle the options, you can figure out what you need. Looks like you need more of ES2015, they show as errors when target is ES5.
console.log(Number.isInteger(1))
const arr = [1, 2, 3]
console.log(arr.entries())
Output
"use strict";
console.log(Number.isInteger(1));
const arr = [1, 2, 3];
console.log(arr.entries());
Compiler Options
{
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"strictBindCallApply": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"alwaysStrict": true,
"esModuleInterop": true,
"declaration": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"target": "ES2017",
"jsx": "react",
"module": "ESNext",
"moduleResolution": "node"
}
}
Playground Link: Provided