this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

update

+28 -16
+18 -16
convex/_generated/dataModel.d.ts
··· 8 8 * @module 9 9 */ 10 10 11 - import { AnyDataModel } from "convex/server"; 11 + import type { 12 + DataModelFromSchemaDefinition, 13 + DocumentByName, 14 + TableNamesInDataModel, 15 + SystemTableNames, 16 + } from "convex/server"; 12 17 import type { GenericId } from "convex/values"; 13 - 14 - /** 15 - * No `schema.ts` file found! 16 - * 17 - * This generated code has permissive types like `Doc = any` because 18 - * Convex doesn't know your schema. If you'd like more type safety, see 19 - * https://docs.convex.dev/using/schemas for instructions on how to add a 20 - * schema file. 21 - * 22 - * After you change a schema, rerun codegen with `npx convex dev`. 23 - */ 18 + import schema from "../schema.js"; 24 19 25 20 /** 26 21 * The names of all of your Convex tables. 27 22 */ 28 - export type TableNames = string; 23 + export type TableNames = TableNamesInDataModel<DataModel>; 29 24 30 25 /** 31 26 * The type of a document stored in Convex. 27 + * 28 + * @typeParam TableName - A string literal type of the table name (like "users"). 32 29 */ 33 - export type Doc = any; 30 + export type Doc<TableName extends TableNames> = DocumentByName< 31 + DataModel, 32 + TableName 33 + >; 34 34 35 35 /** 36 36 * An identifier for a document in Convex. ··· 42 42 * 43 43 * IDs are just strings at runtime, but this type can be used to distinguish them from other 44 44 * strings when type checking. 45 + * 46 + * @typeParam TableName - A string literal type of the table name (like "users"). 45 47 */ 46 - export type Id<TableName extends TableNames = TableNames> = 48 + export type Id<TableName extends TableNames | SystemTableNames> = 47 49 GenericId<TableName>; 48 50 49 51 /** ··· 55 57 * This type is used to parameterize methods like `queryGeneric` and 56 58 * `mutationGeneric` to make them type-safe. 57 59 */ 58 - export type DataModel = AnyDataModel; 60 + export type DataModel = DataModelFromSchemaDefinition<typeof schema>;
+10
convex/schema.ts
··· 1 + import { defineSchema, defineTable } from "convex/server"; 2 + import { v } from "convex/values"; 3 + 4 + export default defineSchema({ 5 + pokemon: defineTable({ 6 + dex_id: v.float64(), 7 + name: v.string(), 8 + }).index("by_dex_id", ["dex_id"]).index("by_name", ["name"]), 9 + types: defineTable({ name: v.string() }).index("by_name", ["name"]), 10 + });