-
Notifications
You must be signed in to change notification settings - Fork 200
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
Is the typescript definition exported correctly? #99
Comments
Same problem with
|
@egasimus I don't think that is the same issue. Typescript definitions were added in [email protected], so that is probably why the declaration file can't be found in your case. Some more info on my issue: import * as fetch from 'unfetch';
console.log(fetch); // { default: f(), __esModule: true } import fetch from 'unfetch';
// error TS1192: Module '"node_modules/unfetch/src/index"' has no default export The last example works if I enable allowSyntheticDefaultImports, but that was not required before. |
Yep, just updated to v4 and have same issue. Definitions are definitely incorrect. |
I believe this is due to TypeScript not respecting the |
Not true, just .d.ts is incorrect. |
So if you do Searching that error, returns the recommendation of doing the following for commonjs modules As such, I've done the following workaround for it: import * as fetchImport from 'isomorphic-unfetch'
const fetch = (fetchImport.default || fetchImport) as typeof fetchImport.default |
Still getting this error. Is there a fix for it? |
I'm having trouble with unfetch >= 3.1.1. The new TypeScript definition actually broke our build, and I'm not sure how to fix it.
The change was made in PR #89, in which the default export was removed from
src/index.d.ts
. Was this intentional? The PR is named "Fix isomorphic-unfetch definition" butpackages/isomorphic-unfetch/index.d.ts
is not changed, insteadsrc/index.d.ts
was changed.Since
src/index.mjs
export default, shouldn'tsrc/index.d.ts
also export default?The text was updated successfully, but these errors were encountered: