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:
{
"extends": ["@sapphire/ts-config", "@sapphire/ts-config/extra-strict", "@sapphire/ts-config/decorators"],
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
"tsBuildInfoFile": "dist/.tsbuildinfo"
},
"include": ["src"]
}
{
"extends": ["@sapphire/ts-config", "@sapphire/ts-config/extra-strict", "@sapphire/ts-config/decorators"],
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
"tsBuildInfoFile": "dist/.tsbuildinfo"
},
"include": ["src"]
}
Solution:
Fixed in @sapphire/fetch v3.0.1 ( #Announcements ) @sach!n
Jump to solution
2 Replies
Favna
Favna12mo ago
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 tsconfig
GitHub
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
Favna
Favna12mo ago
Fixed in @sapphire/fetch v3.0.1 ( #Announcements ) @sach!n
Want results from more Discord servers?
Add your server