-
Notifications
You must be signed in to change notification settings - Fork 517
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
fix: type event.$fetch
and event.fetch
#1343
Conversation
an odd issue here of circular types between runtime/build and stubs (not related to pr). will look into it more later |
This is pending merge and release of unjs/h3#414. |
Codecov Report
@@ Coverage Diff @@
## main #1343 +/- ##
==========================================
+ Coverage 76.58% 76.61% +0.02%
==========================================
Files 70 71 +1
Lines 7193 7232 +39
Branches 715 718 +3
==========================================
+ Hits 5509 5541 +32
- Misses 1683 1690 +7
Partials 1 1
|
event.$fetch
as $Fetch
event.$fetch
and event.fetch
import type { NitroFetchRequest, $Fetch } from "./fetch"; | ||
|
||
export type H3EventFetch = ( | ||
request: NitroFetchRequest, | ||
init?: RequestInit | ||
) => Promise<Response>; | ||
|
||
export type H3Event$Fetch = $Fetch<unknown, NitroFetchRequest>; | ||
|
||
declare module "h3" { | ||
interface H3Event { | ||
/** @experimental Calls fetch with same context and request headers */ | ||
fetch: H3EventFetch; | ||
/** @experimental Calls fetch with same context and request headers */ | ||
$fetch: H3Event$Fetch; | ||
} | ||
} | ||
|
||
export {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Locating these types here will not result in augmenting H3Event
in a Nuxt/Nitro project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merging to double check againt nuxt with edge too to fix any possible bundling issues before... |
Yes, I was checking with build archive as well against a Nuxt project. |
Working for me too - great! |
π Linked issue
β Type of change
π Description
This updates the typing of
event.$fetch
to match the ambient$fetch
. It should be paired with unjs/h3#414 as the nitro build won't pass until we have this merged upstream.π Checklist