Jos*_* M. 8 promise typescript bluebird
我基本上想用PromiseTypesbird 替换Typescript(v2.0.10)中的定义.我读了很多关于这个但是出来很困惑 - 是否有可能?
我真的不想在每个TS文件的顶部执行此操作:
import * as Promise from "bluebird";
Run Code Online (Sandbox Code Playgroud)
我试图在我这样做_stubs.d.ts无济于事:
import * as Bluebird from "bluebird";
declare var Promise: typeof Bluebird;
Run Code Online (Sandbox Code Playgroud)
npm install --save-dev @types/bluebird-global编辑您tsconfig.json要bluebird-global在types数组中列出:
{
"compilerOptions": {
"types": [
"bluebird-global"
],
// the rest of the options
}
}
Run Code Online (Sandbox Code Playgroud)编辑:
如果你不使用第2步是没有必要compilerOptions.types在你的tsconfig.json。
| 归档时间: |
|
| 查看次数: |
1854 次 |
| 最近记录: |