3
기본적으로 Typescript (v2.0.10)의 Promise
정의를 Bluebird로 바꾸고 싶습니다. 나는 이것에 대해 많이 읽었지 만 혼란 스러웠습니다. 가능합니까?Typescript에서 전역 가져 오기?
import * as Bluebird from "bluebird";
declare var Promise: typeof Bluebird;
기본적으로 Typescript (v2.0.10)의 Promise
정의를 Bluebird로 바꾸고 싶습니다. 나는 이것에 대해 많이 읽었지 만 혼란 스러웠습니다. 가능합니까?Typescript에서 전역 가져 오기?
import * as Bluebird from "bluebird";
declare var Promise: typeof Bluebird;
import * as Promise from "bluebird";
내가 아무 소용이 내 _stubs.d.ts
에서이 작업을 수행하려고 :
파일 TS
npm install --save-dev @types/bluebird-global
tsconfig.json
을 편집하여 types
배열에 bluebird-global
을 나열하십시오.
{
"compilerOptions": {
"types": [
"bluebird-global"
],
// the rest of the options
}
}
편집 : 당신이 당신의 tsconfig.json
에 compilerOptions.types
를 사용하지 않는 경우 (2)가 필요하지 않습니다
단계.
[글로벌 기능 보강] (https://www.typescriptlang.org/docs/handbook/declaration-merging.html#global-augmentation)을 찾고 있습니다. – poke