-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 lib defs for apollo-link-http@1.2.x #1552
Conversation
includeExtensions?: boolean; | ||
credentials?: string; | ||
headers?: any; | ||
fetchOptions?: any; |
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.
Should mixed
be used here instead (for both headers
and fetchOptions
)?
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.
any
is fine, as it matches the ts
definition.
declare export interface FetchOptions { | ||
uri?: string; | ||
//todo change to type of Global['fetch'] | ||
fetch?: any; |
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.
What is Global['fetch']
? What is the type of Global['fetch']
? (This is how the value is assigned in the source.)
Is it OK to use any
here? Or mixed
?
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.
any
is fine, as it matches the ts
definition.
|
||
declare export class HttpLink { | ||
//todo change type to RequestHandler from 'apollo-link' | ||
requester: any; |
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.
The type of requester
is RequestHandler
from the apollo-link
package. What is the appropriate way to declare this? (Keep in mind, apollo-link
might not have lib defs either.)
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.
Dependencies between libdefs will probably been handled in the coming 3.0
release, which is currently discussed in #1494.
For now I think it's best to just duplicate the RequestHandler
inside this libdef (like it's done in react-router-dom
& react-router-native
for the duplicate types from react-router
) and add a // TODO:
to delete this in the future when dependencies between libdefs are handled.
} | ||
|
||
//todo change return type to ApolloLink from 'apollo-link' | ||
declare export function createHttpLink(opts: FetchOptions): any; |
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.
Despite the name, the createHttpLink
function seems to return an ApolloLink
which is from the apollo-link
package. What is the appropriate way to declare this? (Keep in mind, apollo-link
might not have lib defs either.)
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.
Same as in my last comment: #1552 (discussion comment)
Seeking clarity about a few things before merging. (Sorry. First-time lib def author/contributor.)