remix-conform-rpc
Version:
Supercharge your remix/react-router actions and loaders with typesafe param and query parsing using conform and zod
7 lines (6 loc) • 360 B
TypeScript
import { z, ZodSchema } from 'zod';
export type WithParams<TParamSchema extends ZodSchema | undefined, TQuerySchema extends ZodSchema | undefined, TData> = TData & (TParamSchema extends ZodSchema ? {
params: z.infer<TParamSchema>;
} : Record<never, never>) & (TQuerySchema extends ZodSchema ? {
query: z.infer<TQuerySchema>;
} : Record<never, never>);