@@ -176,6 +176,7 @@ type SelectValue =
176
176
| undefined // Optional values
177
177
| { [ key : string ] : SelectValue }
178
178
| PrecomputeRefStructure < any >
179
+ | SpreadableRefProxy < any > // For spread operations without internal properties
179
180
| Array < Ref < any > >
180
181
181
182
/**
@@ -247,6 +248,8 @@ export type ResultTypeFromSelect<TSelectObject> = {
247
248
? T
248
249
: TSelectObject [ K ] extends RefProxyFor < infer T >
249
250
? T
251
+ : TSelectObject [ K ] extends SpreadableRefProxy < infer T >
252
+ ? ResultTypeFromSelect < SpreadableRefProxy < T > >
250
253
: TSelectObject [ K ] extends string
251
254
? string
252
255
: TSelectObject [ K ] extends number
@@ -550,6 +553,24 @@ export type RefProxy<T = any> = {
550
553
}
551
554
: { } ) // Primitive types get no additional properties
552
555
556
+ /**
557
+ * SpreadableRefProxy - Type for spread operations that excludes internal properties
558
+ *
559
+ * This type represents what you get when you spread a RefProxy. It omits the internal
560
+ * properties (__refProxy, __path, __type) and only includes the user-facing properties
561
+ * that should be part of the spread operation.
562
+ *
563
+ * This enables clean spread operations like:
564
+ * ```typescript
565
+ * select({
566
+ * id: employees.id,
567
+ * name: employees.name,
568
+ * ...employees.profile // Only spreads bio, skills, contact - not __refProxy etc.
569
+ * })
570
+ * ```
571
+ */
572
+ export type SpreadableRefProxy < T > = Omit < RefProxy < T > , '__refProxy' | '__path' | '__type' >
573
+
553
574
/**
554
575
* Ref - The user-facing ref type with clean IDE display
555
576
*
0 commit comments