Skip to content

generateClientTypes

function generateClientTypes(options): Promise<string>;

Defined in: client/src/generate/generate.ts:107

Fetch the server manifest and compile it into a TypeScript source string that exports both the ApiSchema interface (the compile-time contract handed to createClient) and an apiManifest runtime constant (the metadata and schemas toTools needs to reconstruct tools). Implementers wire this into a small script that writes the result to disk.

Parameter Type
options GenerateOptions

Promise<string>

import { writeFile } from 'node:fs/promises';
import { generateClientTypes } from '@grundlag/client';
await writeFile('./src/client.generated.ts', await generateClientTypes({ url: 'http://localhost:3800' }));