TypeScript Compiler Errors in a String

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

Error TS2339 The property 'fromCharCode' does not exist in the type 'StringConstructor'. MyProject c: ... \ Scripts \ Autocode.ts 70 Active Error TS2339 The property "length" does not exist by type "String". MyProject c: ... \ Scripts \ Autocode.ts 70 Active Error TS2339 The property 'substr' does not exist for the type String. MyProject c: ... \ Scripts \ Autocode.ts 70 Active Error TS2339 The gender property does not exist by type. '' MyProject c: ... \ Scripts \ Autocode.ts 70 Active Error TS2339 The property 'fromCharCode' does not exist by type 'StringConstructor. MyProject c: ... \ Scripts \ Autocode.ts 70 Active Severity Code Description Project File Line Suppression State Error TS2304 Unable to find the 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 The expected expression. 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 works well.

How can I fix these errors?

+4
source share
2 answers

Install VS 2015 Update 3, then install the extension TypeScript 2.0.3 for Visual Studio 2015.

0
source

You may not have included es2015 in your file tsconfig.json:

{
  "compilerOptions": {
     "lib": ["es2015"]
  }
}
0
source

Source: https://habr.com/ru/post/1649564/


All Articles