1. 程式人生 > >[Typescript] Installing Promise Type Definitions Using the lib Built-In Types

[Typescript] Installing Promise Type Definitions Using the lib Built-In Types

efi null gpo module div col ice -c dice

To fix Promise is not recolized in TypeScript, we can choose to use a lib:

npm i @types/es6-promise

we can also use built-in libs:

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es5",
        "noImplicitAny": true,
        "sourceMap": true,
        "strictNullChecks": true
, "noEmitOnError": true, "experimentalDecorators": true, "emitDecoratorMetadata": true, "lib": ["es6"], "skipLibCheck": true }, "exclude": [ "client/node_modules" ] }

Inside "es6" have Promise already, so that we don‘t need to install other devdependices.

[Typescript] Installing Promise Type Definitions Using the lib Built-In Types