api.d.ts
This code is generated
These exports are not directly available in the convex
package!
Instead you must run npx convex dev
to create convex/_generated/api.js
and
convex/_generated/api.d.ts
.
These types require running code generation because they are specific to the Convex functions you define for your app.
If you aren't using code generation, you can use the generic version instead, GenericAPI.
Types
ConvexAPI
Ƭ ConvexAPI: Object
A TypeScript type describing your app's public Convex API.
This ConvexAPI
type includes information about the arguments and return types
of your app's Convex functions.
This type should be used with type-parameterized classes like
ConvexReactClient
and
ConvexHttpClient
to create
app-specific types.
import { ConvexReactClient } from "convex/react";
import { ConvexAPI } from "../convex/_generated/api";
// typically loaded from an environment variable
const address = "https://small-mouse-123.convex.cloud";
const convex = new ConvexReactClient(address);
const convex: ConvexReactClient<ConvexAPI> = new ConvexReactClient(address);