Proper TS types - #117
Conversation
Andarist
commented
Dec 3, 2019
@developit friendly 🏓 |
developit
left a comment
There was a problem hiding this comment.
This looks good to me, but I wonder if it'll cause folks trouble because the types are now different for unfetch VS isomorphic-unfetch? You'd know better than I, I'm not much of a TS user.
Andarist
commented
Feb 18, 2020
Well, depends on how you look at it. It won't cause people much trouble because one is probably not using both in the same project, but I don't know how to properly support types from this PR when using So landing this would definitely make both of those packages providing different typings, but at least for browser-only unfetch users they would be correct and would save users from using it like a regular, full-blown |
developit
commented
Feb 19, 2020
Makes sense. Anyone using |
Andarist
commented
Feb 19, 2020
Yes - thats my understanding. Isomorphic-fetch wont even know about those typings here because they are not referenced anyhow from there |
| } | ||
| declare const unfetch: typeof fetch; | ||
| type UnfetchResponse = { |
There was a problem hiding this comment.
Wouldn't it be better if we export this type so that TS developers could use it in their code?
| } | ||
| } | ||
| type Unfetch = ( |
Andarist
commented
Aug 6, 2020
@developit friendly 🏓 |
Specifying unfetch type as the same as fetch is a stretch - so I've written down better, more accurate types.