Announcing Convex 0.9.2
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 theconvex/
directory, having a singleconvex/tsconfig.json
file to configure TypeScript is simpler. To update to the new format, deleteconvex/tsconfig.json
andconvex/actions/tsconfig.json
and runnpx convex codegen --init
. - There are two new system environment variables:
CONVEX_CLOUD_URL
andCONVEX_SITE_URL
. - Convex now supports
TextEncoder
,TextDecoder
,DOMException
,atob
,btoa
, andconsole.trace
within queries, mutations, and HTTP endpoints. - The
ConvexReactClient
now enqueues action requests when the client is offline and syncs them upon reconnection.