Client SDK

Typed Client

Full TypeScript autocomplete and type checking

Typed Client#

Create a typed proxy for full TypeScript autocomplete and type checking:

typescript
// Define your command types
interface MyCommands {
search: {
params: { query: string; limit?: number }
result: { results: Product[]; total: number }
}
'cart.add': {
params: { sku: string; quantity?: number }
result: { added: string }
}
}
ย 
// Create typed client
const typed = client.typed<MyCommands>()
ย 
// Full autocomplete and type safety
const { results, total } = await typed.search({ query: 'laptop' })
// ^ Product[] ^ number