Happy Friday! We have a little patch release for you with a couple of new goodies. Stay tuned for some big updates coming soon.

Infer<typeof schemaValue>

We’ve added a new Infer type helper to turn pieces of your Convex schema into TypeScript types:

import { defineSchema, defineTable, Infer, s } from "convex/schema";

const nestedObject = s.object({
  property: s.string(),
});

// Resolves to `{property: string}`.
export type NestedObject = Infer<typeof nestedObject>;

export default defineSchema({
  tableName: defineTable({
    nested: nestedObject,
  }),
});

Remember that if you need the type of the documents in a table, you can always access that with Document<TableName>.

Minor Updates

  • Within database queries, you can now put the .order(...) clause after .filter(...). This will feel more familiar if you’re coming from a SQL background.
  • We’re no longer generating convex/actions/tsconfig.json in new projects. Given the inter-connected nature of the convex/ directory, having a single convex/tsconfig.json file to configure TypeScript is simpler. To update to the new format, delete convex/tsconfig.json and convex/actions/tsconfig.json and run npx convex codegen --init.
  • There are two new system environment variables: CONVEX_CLOUD_URL and CONVEX_SITE_URL.
  • Convex now supports TextEncoder, TextDecoder, DOMException, atob, btoa, and console.trace within queries, mutations, and HTTP endpoints.
  • The ConvexReactClient now enqueues action requests when the client is offline and syncs them upon reconnection.