import type { IncomingMessage, ServerResponse } from "node:http"; declare global { type StringSchema = { type: "string"; required?: boolean; length?: [number, number]; regex?: RegExp; enum?: string[]; }; type NumberSchema = { type: "number"; required?: boolean; min?: number; max?: number; integer?: boolean; }; type BooleanSchema = { type: "boolean"; required?: boolean; }; type ArraySchema = { type: "array"; required?: boolean; length?: [number, number]; items?: PropSchema; }; type PropSchema = StringSchema | NumberSchema | BooleanSchema | ArraySchema; type InferPropType = T extends StringSchema ? string : T extends NumberSchema ? number : T extends BooleanSchema ? boolean : T extends ArraySchema ? T["items"] extends PropSchema ? InferPropType[] : unknown[] : never; type InferProps> = { [K in keyof TSchema as TSchema[K]["required"] extends false ? never : K]: InferPropType; } & { [K in keyof TSchema as TSchema[K]["required"] extends false ? K : never]?: InferPropType; }; interface ActionContext { req: IncomingMessage; res: ServerResponse; } type WithContext = [TProps] extends [never] ? ActionContext : TProps & ActionContext; interface ServerActionDefinitionTyped, TReturn> { props: TSchema; callback(args: InferProps & ActionContext): TReturn; } interface ServerActionDefinitionUntyped { callback(args: WithContext): TReturn; } interface RuntimeServerActionDefinition { props?: Record; callback(params: Record): any; id: string; } type ServerActionFn = [ TProps ] extends [never] ? () => Promise : (args: TProps) => Promise; function serverAction, TReturn = void>(def: ServerActionDefinitionTyped): ServerActionFn, TReturn>; function serverAction(def: ServerActionDefinitionUntyped): ServerActionFn; function serverAction(def: ServerActionDefinitionUntyped): ServerActionFn; var __serverActions: RuntimeServerActionDefinition[]; } export {}; //# sourceMappingURL=server-actions.d.ts.map