Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeScript Compiler Errors on String

I have this strange problem in my VS 2015 project where I'm getting 47,114 compiler errors in Typescript but the program works anyway, and generates the JS file correctly.

Error TS2339 Property 'fromCharCode' does not exist on type 'StringConstructor'. MyProject c:...\Scripts\Autocode.ts 70 Active Error TS2339 Property 'length' does not exist on type 'String'. MyProject c:...\Scripts\Autocode.ts 70 Active Error TS2339 Property 'substr' does not exist on type 'String'. MyProject c:...\Scripts\Autocode.ts 70 Active Error TS2339 Property 'floor' does not exist on type ''. MyProject c:...\Scripts\Autocode.ts 70 Active Error TS2339 Property 'fromCharCode' does not exist on type 'StringConstructor'. MyProject c:...\Scripts\Autocode.ts 70 Active Severity Code Description Project File Line Suppression State Error TS2304 Cannot find name 'number'. MyProject C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript\lib.d.ts 5925 Active Error TS1005 ';' expected. MyProject C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript\lib.d.ts 5925 Active Error TS1109 Expression expected. MyProject C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript\lib.d.ts 5925 Active

47,000 of these types of errors but the program runs well.

How can I correct these errors?

like image 723
JedK Avatar asked Nov 08 '22 11:11

JedK


1 Answers

You might not have included es2015 into your tsconfig.json file:

{
  "compilerOptions": {
     "lib": ["es2015"]
  }
}
like image 188
Flavien Volken Avatar answered Nov 15 '22 07:11

Flavien Volken