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

Posted Answer1215

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Typescript] Installing Promise Type Definitions Using the lib Built-In Types相关的知识,希望对你有一定的参考价值。

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的主要内容,如果未能解决你的问题,请参考以下文章

Installing Pytorch in Ubuntu

win10 解决Failed installing 'Tomcat8' service

Django - installing mysqlclient error: mysqlclient 1.3.13 or newer is required; you have 0.9.3

如何使用“p-waterfall”TypeScript 类型

Angular/TypeScript:获取 <p> 的背景图片 URL

TypeScript 参数类型推断失败