tomT
Convex Community4mo ago
5 replies
tom

The Shadow Types

for convex side code (e.g. an action calling a query) i import
api
or
internal
from an alternative set of types
import { api, internal } from "../../_convex/shadow";

these being generated by the convex helpers which is fully materialized, just the way components already are in the standard
_generated/api.d.ts

this allows
FunctionReturnType
to just work on the action reference, and we get full typing (no ts circular error), without creating extra hard coded types
catch is, anytime time the query the action uses changes, we need to re run the convex helper
but this seems better than manually updating duplicate explicit types?
Was this page helpful?