Utilizing typings for loading type definitions. In my project, I am utilizing bluebird as the promise implementation. The following lines are present in my typings.json
:
"Promise": "github:DefinitelyTyped/DefinitelyTyped/bluebird/bluebird.d.ts#dd328830dddffbe19e9addd7cf8532cbd3600816",
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#48c1e3c1d6baefa4f1a126f188c27c4fefd36bff",
The typings (version 1.0.3) generates the subsequent typings/index.d.ts
:
/// <reference path="globals/node/index.d.ts" />
/// <reference path="globals/Promise/index.d.ts" />
During compilation, tsc throws errors wherever Promise is used, such as:
error TS2339: Property 'exists' does not exist on type 'Promise<IResourcePatched> | Promise<string>'
Despite the correctness of the code which previously functioned without issues. Upon switching the order of the lines in typings/index.d.ts
to reference bluebird first, the program compiles and functions as expected...
Evidently, tsc adopts the definition of Promise it encounters first, with the one from node differing slightly from that of bluebird.
Enquiry lies in how to ensure that typings list the dependencies in index.d.ts
in the required order or how to eliminate the Promise declaration from the node definition?
PS: Requesting someone with adequate reputation to include a typings tag on StackOverflow.
Update: Attempted altering the order of typings in typings.json
only to observe node typings consistently positioned before Promise. They seem to be arranged alphabetically...
Update 2: It turns out there isn't a Promise definition within node but rather within the module "es6-shim", necessitated as a dependency by angular2. Different names, same issue: ordering.
Note: TypeScript-Compiler set up to generate es5 code.