-
Notifications
You must be signed in to change notification settings - Fork 115
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 type definitions to make it Typescript compatible #176
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,8 @@ | |
], | ||
"author": "Thuzi LLC <[email protected]> (https://github.com/Thuzi)", | ||
"contributors": [ | ||
"Daniel Friesen <[email protected]> (http://danf.ca)" | ||
"Daniel Friesen <[email protected]> (http://danf.ca)", | ||
"Shibu Lijack <[email protected]> (https://github.com/shibulijack" | ||
], | ||
"homepage": "https://github.com/node-facebook/facebook-node-sdk", | ||
"license": "Apache-2.0", | ||
|
@@ -18,6 +19,7 @@ | |
"url": "https://github.com/node-facebook/facebook-node-sdk.git" | ||
}, | ||
"main": "./lib/fb.js", | ||
"types": "./lib/fb.d.ts", | ||
"scripts": { | ||
"precommit": "lint-staged", | ||
"lint": "eslint .", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
interface FBOptions { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A bunch of options appear to be missing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I used the ones mentioned in the README. Turns out the list wasn't exhaustive. I'll update the options with the ones listed in the source code. |
||
accessToken: string; | ||
appId: string; | ||
appSecret: string; | ||
version?: string; | ||
proxy?: string; | ||
timeout?: number; | ||
scope?: string; | ||
redirectUri?: string; | ||
Promise?: Promise; | ||
} | ||
|
||
export class Facebook { | ||
shibulijack marked this conversation as resolved.
Show resolved
Hide resolved
|
||
constructor(options: FBOptions); | ||
shibulijack marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
api(...args): Promise<any>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does not look like valid TypeScript. Also even though DefinitelyTyped discourages it, we might want to consider using a generic here instead of any. |
||
|
||
extend(options: FBOptions): Facebook; | ||
|
||
getAccessToken(): string; | ||
|
||
getLoginUrl(): string; | ||
shibulijack marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
napi(...args): Promise<any>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. napi does not return a promise, it accepts a node style callback. |
||
|
||
options(keyOrOptions: FBOptions): FBOptions; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This needs overloading for the other ways it can be called.
|
||
|
||
parseSignedRequest(signedRequest: string, ...args): Object; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't look valid and should have something better than |
||
|
||
setAccessToken(accessToken: string): void; | ||
|
||
withAccessToken(accessToken: string): any; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should also be Facebook |
||
} | ||
|
||
export const version: string; | ||
|
||
export function FacebookApiException(res: Response): void; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
export const FB: Facebook; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is also a default export. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing
)
, if you're going to make yourself the only one of the many people who has submitted PRs to this library attributed here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry but I don't understand. I'll fix the missing parenthesis but am I missing anything else here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I was just noting that there are 16 other people who have contributed code to this library and none of them are credited in the contributors list. It's really only listing me because I took over as maintainer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright. I'll remove myself from the contributor list.
Just curious though, shouldn't all the 16 people be included in the contributor list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps, but in general I think most npm packages bother adding everyone to the contributors list. I sometimes see a CONTRIBUTORS file. But the contributors list is usually kept short, presumably because it's downloaded by everyone that installs the library.