Reusable inferSSRProps
parent
4fa380d7ed
commit
98d7d7a11c
|
@ -0,0 +1,11 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
type GetSSRResult<TProps> =
|
||||
//
|
||||
{ props: TProps } | { redirect: any } | { notFound: boolean };
|
||||
|
||||
type GetSSRFn<TProps> = (...args: any[]) => Promise<GetSSRResult<TProps>>;
|
||||
|
||||
export type inferSSRProps<TFn extends GetSSRFn<any>> = TFn extends GetSSRFn<infer TProps>
|
||||
? NonNullable<TProps>
|
||||
: never;
|
Loading…
Reference in New Issue