Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

dataModel.d.ts

60 lines1.7 KB

1/* eslint-disable */
2/**
3 * Generated data model types.
4 *
5 * THIS CODE IS AUTOMATICALLY GENERATED.
6 *
7 * To regenerate, run `npx convex dev`.
8 * @module
9 */
10​
11import type {
12 DataModelFromSchemaDefinition,
13 DocumentByName,
14 TableNamesInDataModel,
15 SystemTableNames,
16} from 'convex/server'
17import type { GenericId } from 'convex/values'
18import schema from '../schema.js'
19​
20/**
21 * The names of all of your Convex tables.
22 */
23export type TableNames = TableNamesInDataModel<DataModel>
24​
25/**
26 * The type of a document stored in Convex.
27 *
28 * @typeParam TableName - A string literal type of the table name (like "users").
29 */
30export type Doc<TableName extends TableNames> = DocumentByName<
31 DataModel,
32 TableName
34​
35/**
36 * An identifier for a document in Convex.
37 *
38 * Convex documents are uniquely identified by their `Id`, which is accessible
39 * on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids).
40 *
41 * Documents can be loaded using `db.get(id)` in query and mutation functions.
42 *
43 * IDs are just strings at runtime, but this type can be used to distinguish them from other
44 * strings when type checking.
45 *
46 * @typeParam TableName - A string literal type of the table name (like "users").
47 */
48export type Id<TableName extends TableNames | SystemTableNames> =
49 GenericId<TableName>
50​
51/**
52 * A type describing your Convex data model.
53 *
54 * This type includes information about what tables you have, the type of
55 * documents stored in those tables, and the indexes defined on them.
56 *
57 * This type is used to parameterize methods like `queryGeneric` and
58 * `mutationGeneric` to make them type-safe.
59 */
60export type DataModel = DataModelFromSchemaDefinition<typeof schema>