-
Notifications
You must be signed in to change notification settings - Fork 518
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
dbba233
fix: type `event.$fetch`
danielroe a2c6a77
fix: update typing in usage
danielroe ca4e8a7
fix: update imports
danielroe 7a06e9c
[autofix.ci] apply automated fixes
autofix-ci[bot] 5c644fd
Merge branch 'main' into fix/event-fetch-type
pi0 2985b9f
refactor: improve `event.fetch` types (partial)
pi0 bdda171
fix types for `event.fetch`
pi0 3424d30
refactor: move h3 augmentation to src/types/h3
pi0 a1b5ee3
revert top level types.d change
pi0 a14a5a8
export types for event fetch methods
pi0 d52768c
simplify
pi0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
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 {}; | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export * from './dist/index' | ||
export * from './dist/runtime/types' | ||
export * from "./dist/index"; | ||
export * from "./dist/runtime/types"; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 projectThere 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.
Testing build archive against nitro-deploys, seems to be working fine: