Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added basic Typescript definitions. #46

Closed
wants to merge 10 commits into from
Prev Previous commit
Next Next commit
Use dependency's Promise TS definition.
andrewstart committed May 23, 2016
commit fd072b87dd6b2f238b53e4b5da82dab0e26fb52d
84 changes: 0 additions & 84 deletions es6-promise.d.ts

This file was deleted.

3 changes: 2 additions & 1 deletion fb.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/// <reference path="./es6-promise.d.ts" />
import Promise = require("any-promise");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this line. Promise can be used directly without importing it as it is part of ES6.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While that is true, that doesn't mean that everyone is using an ES6 environment, and additionally this library uses any-promise as the Promise implementation.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's how i have seen it used in most well written typings I have used. If you are not targeting ES6, it is up to the consumer to provide the typings for Promise. Example from a fairy recent declaration https://github.com/facebook/dataloader/blob/master/src/index.d.ts

Copy link

@ibratoev ibratoev Feb 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally, 2.0 of this library supports only NodeJS environments that support Promise natively ;)


export class Facebook {
api(path: string): Promise<any>;
api(path: string, callback: (response: any) => void): void;