Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
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 unfetch@3.1.0, 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 exportThe 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.tsis not changed, insteadsrc/index.d.tswas changed.Since
src/index.mjsexport default, shouldn'tsrc/index.d.tsalso export default?