zl程序教程

您现在的位置是:首页 >  前端

当前栏目

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

typescript in The type Using Promise lib types
2023-09-14 08:59:17 时间

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.