[TypeScript][Fetch] replace isomorphic fetch with portable fetch#6739
Conversation
|
@jeff-99 thanks for the PR but the CIs failed with the following: Please take a look when you've time. |
…somorphic-fetch-with-portable-fetch
|
@wing328 , comitted the missing files. Build now seems to fail at the same step as the master branch. |
|
Thanks for the PR. |
|
@TiFu the security tests are regenerated |
|
@jeff-99 thanks for the PR, which has been merged into master. |
| */ | ||
| export interface FetchAPI { | ||
| (url: string, init?: any): Promise<Response>; | ||
| (url: string, init?: any): Promise<any>; |
There was a problem hiding this comment.
What I don't understand is: if I run the tests today, without modifying anything, I find that this is changed back to Response. So something is broken in the way CI is being done for pull requests, because if the CI was working correctly it would reject this change.
I suspect the fact that there is a merge commit in here somehow confused things. In the future, it is probably best to require all pull-requests to be a single chain of commits that is rebased to the tip of master.
|
Aside from the comments above, it is probably not a good idea to constantly be modifying the fetch dependency in here. If you need a special If it wasn't a breaking change I would suggest removing the default fetch from this generator entirely, and make |
|
I believe the purpose of this change wasn't to just flip to a special
implementation. I think there was a problem with isomorphic and they
weren't resolving it so the pr changed to another that is a fork of
isomorphic but fixes more issues . In general that seems fine but if there
is a way to abstract the library from the client and let them know they
need to choose a client that would be great. I still think having a
default client is great though.
…On Sat, Nov 18, 2017, 4:43 PM Asad Saeeduddin ***@***.***> wrote:
Aside from the comments above, it is probably not a good idea to
constantly be modifying the fetch dependency in here. If you need a special
fetch implementation to suit your needs, you can just inject it when
creating your *API instance.
If it wasn't a breaking change I would suggest removing the default fetch
from this generator entirely, and make fetch a required argument.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6739 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AMPLteqBmpXqw-0qPRoqEpOrTHrh2KYkks5s3095gaJpZM4P-Q0e>
.
|
|
@kenisteward The current implementation already abstracts the library from the fetch client. So when you instantiate your I think what would be better than having There probably isn't a way to represent this in a good way in the types, but you could make it a runtime error if you instantiate |
|
Ideally we would hide all request code (e.g. fetch, and whatever other request methods are out there) behind one unified interface - making future integration with the other typescript code generators far easier and maybe provide one/some default implementations of that interface e.g. for node-fetch, isomorphic-fetch |
Description of the PR
Fixes #6738
I replaced the isomorphic-fetch dependency with a well maintained fork (portable-fetch https://github.com/Knotis/portable-fetch) which supports React Native