Skip to main content

dataModel.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/dataModel.d.ts.

Generated data model types.

Types

TableNames

Ƭ TableNames: string

The names of all of your Convex tables.


Doc

Ƭ Doc<TableName>: Object

The type of a document stored in Convex.

Type parameters

NameTypeDescription
TableNameextends TableNamesA string literal type of the table name (like "users").

Id

An identifier for a document in Convex.

Convex documents are uniquely identified by their Id, which is accessible on the _id field. To learn more, see Document IDs.

Documents can be loaded using db.get(id) in query and mutation functions.

IDs are just strings at runtime, but this type can be used to distinguish them from other strings when type checking.

This is an alias of GenericId that is typed for your data model.

Type parameters

NameTypeDescription
TableNameextends TableNamesA string literal type of the table name (like "users").

DataModel

Ƭ DataModel: Object

A type describing your Convex data model.

This type includes information about what tables you have, the type of documents stored in those tables, and the indexes defined on them.

This type is used to parameterize methods like queryGeneric and mutationGeneric to make them type-safe.