-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
77 additions
and
16 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 1,2 @@ | ||
export {nappiPlugin} from "./plugin"; | ||
export type {InferResponse} from "./inferResponse"; |
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
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,14 @@ | ||
declare module "safe-nappi" { | ||
import { NextApiHandler } from "next"; | ||
import type {default as unsafeUser} from "../pages/api/unsafeUser"; | ||
import type {default as users_index} from "../pages/api/users/index"; | ||
import type {default as users_id_index} from "../pages/api/users/[id]/index"; | ||
export type InferResponse<Handler> = Handler extends NextApiHandler<infer Response> ? Response : never; | ||
type SafeNappiMapping = { | ||
[`/api/unsafeUser`]: InferResponse<typeof unsafeUser>; | ||
[`/api/users`]: InferResponse<typeof users_index>; | ||
[_: `/api/users/${string}`]: InferResponse<typeof users_id_index>; | ||
["/api/users/[id]"]: never; | ||
} | ||
export function jsonFetch<Path extends keyof SafeNappiMapping>(path: Path): Promise<SafeNappiMapping[Path]>; | ||
} |