Typescript error on trying to use fetch
node_modules/@sapphire/fetch/dist/cjs/index.d.ts:264:12 - error TS2304: Cannot find name 'BodyInit'.
264 body?: BodyInit | Record<any, any>;
~~~~
tsconfig:
2 Replies
This will be fixed by https://github.com/sapphiredev/utilities/pull/694 https://github.com/sapphiredev/utilities/pull/695
For now you can add
"lib": ["ESNext", "DOM"]
do your tsconfigGitHub
fix(tsconfig): add DOM types to lib by favna · Pull Request #694 · ...
Too often does it happen that @types/node does not expose everything that is officially available in the Global scope to the Global scope. A perfect example of this is that without DOM types when c...
GitHub
fix(fetch): add additional reference lib comment by favna · Pull Re...
This is faintly related to #694, however, this time the issue is fixed from the @sapphire/fetch side of things. The way tsup is bundling our package is by putting the content from src/lib/types.ts ...
Solution
Fixed in @sapphire/fetch v3.0.1 ( #Announcements ) @sach!n