inferred-types 0.53.9 → 0.53.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -33757,11 +33757,11 @@ type TruthyReturns<T extends readonly unknown[]> = TupleToUnion<{
|
|
|
33757
33757
|
* Tests whether any of the object in T are explicitly missing
|
|
33758
33758
|
* the property P
|
|
33759
33759
|
*/
|
|
33760
|
-
type HasMissingInstance<T extends readonly
|
|
33760
|
+
type HasMissingInstance<T extends readonly AnyObject[], P extends string> = [] extends T ? false : P extends keyof First<T> ? HasMissingInstance<AfterFirst<T>, P> : true;
|
|
33761
33761
|
/**
|
|
33762
33762
|
* removes objects that do not have the property P
|
|
33763
33763
|
*/
|
|
33764
|
-
type RemoveMissing<T extends readonly
|
|
33764
|
+
type RemoveMissing<T extends readonly AnyObject[], P extends string, R extends readonly AnyObject[] = []> = [] extends T ? R[number] : RemoveMissing<AfterFirst<T>, P, P extends keyof First<T> ? [
|
|
33765
33765
|
...R,
|
|
33766
33766
|
First<T>
|
|
33767
33767
|
] : R>;
|
|
@@ -33785,7 +33785,7 @@ type RemoveMissing<T extends readonly Record<string, unknown>[], P extends strin
|
|
|
33785
33785
|
* type U = UnionFromProp<typeof data, "id">;
|
|
33786
33786
|
* ```
|
|
33787
33787
|
*/
|
|
33788
|
-
type UnionFromProp<T extends readonly
|
|
33788
|
+
type UnionFromProp<T extends readonly AnyObject[], P extends string> = HasMissingInstance<T, P> extends true ? Get$1<RemoveMissing<T, P>, P> | undefined : Get$1<T[number], P>;
|
|
33789
33789
|
|
|
33790
33790
|
type _Keys$2<T extends object> = UnionToTuple$1<keyof RemoveIndexKeys<T>> extends readonly ObjectKey[] ? UnionToTuple$1<keyof RemoveIndexKeys<T>> : never;
|
|
33791
33791
|
type ProcessObj$1<T extends Container, TKeys extends readonly PropertyKey[], TResults extends Dictionary = EmptyObject> = [] extends TKeys ? TResults : First<TKeys> extends keyof T ? IfNever<T[First<TKeys>], ProcessObj$1<T, AfterFirst<TKeys>, TResults>, ProcessObj$1<T, AfterFirst<TKeys>, First<TKeys> extends keyof T ? TResults extends readonly unknown[] ? [...TResults, T[First<TKeys>]] : TResults extends Dictionary ? TResults & Record<First<TKeys>, T[First<TKeys>]> : never : never>> : never;
|
|
@@ -15253,11 +15253,11 @@ type TruthyReturns<T extends readonly unknown[]> = TupleToUnion<{
|
|
|
15253
15253
|
* Tests whether any of the object in T are explicitly missing
|
|
15254
15254
|
* the property P
|
|
15255
15255
|
*/
|
|
15256
|
-
type HasMissingInstance<T extends readonly
|
|
15256
|
+
type HasMissingInstance<T extends readonly AnyObject[], P extends string> = [] extends T ? false : P extends keyof First<T> ? HasMissingInstance<AfterFirst<T>, P> : true;
|
|
15257
15257
|
/**
|
|
15258
15258
|
* removes objects that do not have the property P
|
|
15259
15259
|
*/
|
|
15260
|
-
type RemoveMissing<T extends readonly
|
|
15260
|
+
type RemoveMissing<T extends readonly AnyObject[], P extends string, R extends readonly AnyObject[] = []> = [] extends T ? R[number] : RemoveMissing<AfterFirst<T>, P, P extends keyof First<T> ? [
|
|
15261
15261
|
...R,
|
|
15262
15262
|
First<T>
|
|
15263
15263
|
] : R>;
|
|
@@ -15281,7 +15281,7 @@ type RemoveMissing<T extends readonly Record<string, unknown>[], P extends strin
|
|
|
15281
15281
|
* type U = UnionFromProp<typeof data, "id">;
|
|
15282
15282
|
* ```
|
|
15283
15283
|
*/
|
|
15284
|
-
type UnionFromProp<T extends readonly
|
|
15284
|
+
type UnionFromProp<T extends readonly AnyObject[], P extends string> = HasMissingInstance<T, P> extends true ? Get$1<RemoveMissing<T, P>, P> | undefined : Get$1<T[number], P>;
|
|
15285
15285
|
|
|
15286
15286
|
type _Keys$2<T extends object> = UnionToTuple$1<keyof RemoveIndexKeys<T>> extends readonly ObjectKey[] ? UnionToTuple$1<keyof RemoveIndexKeys<T>> : never;
|
|
15287
15287
|
type ProcessObj$1<T extends Container, TKeys extends readonly PropertyKey[], TResults extends Dictionary = EmptyObject> = [] extends TKeys ? TResults : First<TKeys> extends keyof T ? IfNever<T[First<TKeys>], ProcessObj$1<T, AfterFirst<TKeys>, TResults>, ProcessObj$1<T, AfterFirst<TKeys>, First<TKeys> extends keyof T ? TResults extends readonly unknown[] ? [...TResults, T[First<TKeys>]] : TResults extends Dictionary ? TResults & Record<First<TKeys>, T[First<TKeys>]> : never : never>> : never;
|