N
Nuxt8mo ago
jonas

difference between type `$Fetch` from ofetch and nitropack

What's the difference between
import { type $Fetch } from "nitropack";
import { type $Fetch } from "nitropack";
and
import { type $Fetch } from "ofetch"?
import { type $Fetch } from "ofetch"?
Currently if I try to use the one from "ofetch" I'm seeing
Argument of type '$Fetch<unknown, NitroFetchRequest>' is not assignable to parameter of type '$Fetch'.
Property 'native' is missing in type '$Fetch<unknown, NitroFetchRequest>' but required in type '$Fetch'.
Argument of type '$Fetch<unknown, NitroFetchRequest>' is not assignable to parameter of type '$Fetch'.
Property 'native' is missing in type '$Fetch<unknown, NitroFetchRequest>' but required in type '$Fetch'.
I'm currently using the one from "nitropack" in my nuxt project and it works fine, but I want to extract my ApiClient (which takes a $fetch argument in the constructor) to a separate package so I can use it in other contexts and I would like this package to only depend on "ofetch". Any ideas?
2 Replies
dys
dys6mo ago
hey did you find an answer ? I ended using typeof $fetch instead
jonas
jonas6mo ago
No I did not figure this out yet
Want results from more Discord servers?
Add your server