@tstdl/base 0.82.76 → 0.82.77
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.
- package/package.json +1 -1
- package/types.d.ts +3 -1
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -79,8 +79,9 @@ export type StringNumberMap<T = any> = {
|
|
|
79
79
|
};
|
|
80
80
|
export type OneOrMany<T> = T | readonly T[];
|
|
81
81
|
export type WritableOneOrMany<T> = T | T[];
|
|
82
|
+
type FromEntriesEntryValue<T extends readonly (readonly [any, any])[], K> = Extract<T[number], readonly [K, any]>[1];
|
|
82
83
|
export type FromEntries<T> = T extends readonly (readonly [infer Key, any])[] ? {
|
|
83
|
-
[K in Cast<Key, PropertyKey>]:
|
|
84
|
+
[K in Cast<Key, PropertyKey>]: Fallback<FromEntriesEntryValue<T, K>, T[number][1]>;
|
|
84
85
|
} : never;
|
|
85
86
|
export type Writable<T> = {
|
|
86
87
|
-readonly [P in keyof T]: T[P];
|
|
@@ -146,6 +147,7 @@ export type IfUnknown<T, Then, Else = never> = unknown extends T ? Then : Else;
|
|
|
146
147
|
export type IsAny<T> = IfAny<T, true, false>;
|
|
147
148
|
export type IsUnknown<T> = IfUnknown<T, true, false>;
|
|
148
149
|
export type If<B extends Boolean, Then, Else> = B extends true ? Then : Else;
|
|
150
|
+
export type Fallback<T, F> = T extends never ? F : T;
|
|
149
151
|
export type PartialProperty<T, P extends keyof T> = Omit<T, P> & Partial<Pick<T, P>>;
|
|
150
152
|
export type TypeOf<T extends object, P extends keyof T> = T[P];
|
|
151
153
|
export type PropertyOf<T extends object, P extends keyof T> = Property<Of<T>, P>;
|