Reputation: 7740
I'm making a simple class (Primrose
) that extends the global Promise
to add resolve
and reject
methods
export class Primrose<Resolution> extends Promise<Resolution>{
private _resolve: /* Type binding should be here */
private _reject: /* Type binding should be here */
constructor() {
super((_resolve, _reject) => {
this._resolve = _resolve
this._reject = _reject
})
}
resolve(resolution: Resolution) {
this._resolve(resolution)
}
reject(rejection) {
this._reject(rejection)
}
}
I want to give _promise
and _reject
the proper type bindings, however I don't know where those are. Where can I find them?
Upvotes: 0
Views: 39
Reputation: 9
You should get typings for Promise if you either
a) Install types for node: npm install --save-dev @types/node
Or
b) Or if a browser framework, add "dom" to your lib array inside your tsconfig: lib: ["dom", "es2015"...etc]
Upvotes: 1