You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @template {{ [key: string|symbol|number]: $Schema<any> }} S
221
+
* @typedef {{ [Key in keyof S as S[Key] extends $Optional<$Schema<any>> ? Key : never]?: S[Key] extends $Optional<$Schema<infer Type>> ? Type : never } & { [Key in keyof S as S[Key] extends $Optional<$Schema<any>> ? never : Key]: S[Key] extends $Schema<infer Type> ? Type : never }} $ObjectToType
222
+
*/
223
+
195
224
/**
196
225
* @template {{[key:string|symbol|number]: $Schema<any>}} S
197
-
* @extends {$Schema<{ [Key in keyof S]: S[Key] extends $Schema<infer Type> ? Type : never }>}
226
+
* @extends {$Schema<$ObjectToType<S>>}
198
227
*/
199
228
exportclass$Objectextends$Schema{
200
229
/**
@@ -207,19 +236,21 @@ export class $Object extends $Schema {
207
236
208
237
/**
209
238
* @param {any} o
210
-
* @return {o is { [K in keyof S]: S[K] extends $Schema<infer Type> ? Type : never }}
// I used an explicit type annotation instead of $ObjectToType, so that the user doesn't see the
247
+
// weird type definitions when inspecting type definions.
217
248
/**
218
-
* @template {{ [key:string|symbol|number]: $Schema<any> }} T
219
-
* @param {T} def
220
-
* @return {CastToSchema<$Object<T>>}
249
+
* @template {{ [key:string|symbol|number]: $Schema<any> }} S
250
+
* @param {S} def
251
+
* @return {$Schema<{ [Key in keyof S as S[Key] extends $Optional<$Schema<any>> ? Key : never]?: S[Key] extends $Optional<$Schema<infer Type>> ? Type : never } & { [Key in keyof S as S[Key] extends $Optional<$Schema<any>> ? never : Key]: S[Key] extends $Schema<infer Type> ? Type : never }>}
0 commit comments