@@ -987,7 +987,7 @@ export interface DerivedExpr {
987987 * Set values for updates - plain values only.
988988 */
989989export type SetValues < T extends Table < any > > = {
990- [ K in keyof Infer < T > ] ?: Infer < T > [ K ] ;
990+ [ K in keyof Row < T > ] ?: Row < T > [ K ] ;
991991} ;
992992
993993// ============================================================================
@@ -1017,10 +1017,10 @@ type UnwrapZod<T> =
10171017 * const Posts = table("posts", {
10181018 * authorId: z.string().db.references(Users, "author"),
10191019 * });
1020- * type PostRefs = InferRefs <typeof Posts["schema"]["shape"]>;
1020+ * type PostRefs = RowRefs <typeof Posts["schema"]["shape"]>;
10211021 * // { author: typeof Users }
10221022 */
1023- export type InferRefs < T extends ZodRawShape > = {
1023+ export type RowRefs < T extends ZodRawShape > = {
10241024 [ K in keyof T as UnwrapZod < T [ K ] > extends { readonly __refAs : infer As }
10251025 ? As extends string
10261026 ? As
@@ -1040,7 +1040,7 @@ type FilterRefs<
10401040 PickedShape extends ZodRawShape ,
10411041 OriginalRefs extends Record < string , Table < any , any > > ,
10421042> = {
1043- [ Alias in keyof OriginalRefs as Alias extends keyof InferRefs < PickedShape >
1043+ [ Alias in keyof OriginalRefs as Alias extends keyof RowRefs < PickedShape >
10441044 ? Alias
10451045 : never ] : OriginalRefs [ Alias ] ;
10461046} ;
@@ -1610,7 +1610,7 @@ export function table<T extends Record<string, ZodType>>(
16101610 name : string ,
16111611 shape : T ,
16121612 options : TableOptions = { } ,
1613- ) : Table < T , InferRefs < T > > {
1613+ ) : Table < T , RowRefs < T > > {
16141614 // Validate table name for dangerous characters
16151615 validateIdentifier ( name , "table" ) ;
16161616
@@ -2468,11 +2468,6 @@ export type Queryable<
24682468 */
24692469export type Row < T extends Queryable < any > > = z . infer < T [ "schema" ] > ;
24702470
2471- /**
2472- * @deprecated Use `Row<T>` instead.
2473- */
2474- export type Infer < T extends Queryable < any > > = Row < T > ;
2475-
24762471// ============================================================================
24772472// Join Result Types (Magic Types for Multi-Table Queries)
24782473// ============================================================================
@@ -2490,7 +2485,7 @@ type GetRefs<T extends Queryable<any, any>> =
24902485 * For example, if Posts has `{ author: typeof Users }` refs and Users is in JoinedTables,
24912486 * this produces `{ author: Row<typeof Users> }`.
24922487 */
2493- type ResolveRefs <
2488+ type ResolvedRow <
24942489 Refs extends Record < string , Table < any , any > > ,
24952490 JoinedTables extends readonly Queryable < any , any > [ ] ,
24962491> = {
@@ -2511,10 +2506,10 @@ type ResolveRefs<
25112506 * const posts = await db.all([Posts, Users])`JOIN users ON ...`;
25122507 * posts[0].author?.name; // typed as string | undefined
25132508 */
2514- export type WithRefs <
2509+ export type JoinedRow <
25152510 PrimaryTable extends Queryable < any , any > ,
25162511 JoinedTables extends readonly Queryable < any , any > [ ] ,
2517- > = Row < PrimaryTable > & ResolveRefs < GetRefs < PrimaryTable > , JoinedTables > ;
2512+ > = Row < PrimaryTable > & ResolvedRow < GetRefs < PrimaryTable > , JoinedTables > ;
25182513
25192514/**
25202515 * Type guard that evaluates to `never` for partial or derived tables.
0 commit comments