yummies 7.4.0 → 7.6.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yummies",
3
- "version": "7.4.0",
3
+ "version": "7.6.0",
4
4
  "keywords": [
5
5
  "javascript",
6
6
  "typescript",
package/types.d.ts CHANGED
@@ -49,6 +49,12 @@ type NotNullable<T> = Exclude<T, null>;
49
49
  * @returns Record with any keys and any values
50
50
  */
51
51
  type AnyObject = Record<keyof any, any>;
52
+ /**
53
+ * Represents dictionary with any keys and expecting values;
54
+ *
55
+ * @returns Record with any keys and values
56
+ */
57
+ type Dict<TValues = any, TKeys extends keyof any = keyof any> = Record<TKeys, TValues>;
52
58
  /**
53
59
  * Represents an empty object with no properties.
54
60
  *
@@ -133,6 +139,16 @@ type DeepPartial<T> = T extends BrowserNativeObject ? T : {
133
139
  * @returns A type with specified keys optional and others required
134
140
  */
135
141
  type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
142
+ /**
143
+ * Makes specified keys of a type possibly Maybe<T> while keeping the rest required.
144
+ *
145
+ * @template T - The original type
146
+ * @template TMaybeKeys - The keys to make possibly Maybe<T>
147
+ * @returns A type with specified keys possibly Maybe<T> and others required
148
+ */
149
+ type MaybeKeys<T, TMaybeKeys extends keyof T> = {
150
+ [K in keyof T]: K extends TMaybeKeys ? Maybe<T[K]> : T[K];
151
+ };
136
152
  /**
137
153
  * Makes specified keys of a type required while keeping the rest optional.
138
154
  *
@@ -438,4 +454,4 @@ type AnyBoolean = boolean & {};
438
454
  */
439
455
  type UpperFirst<S extends string> = S extends `${infer F}${infer R}` ? `${Uppercase<F>}${R}` : S;
440
456
 
441
- export type { AllPropertiesOptional, AnyBoolean, AnyFunction, AnyNumber, AnyObject, AnyPrimitive, AnyString, BrowserNativeObject, Class, CopyObject, DeepPartial, Defined, EmptyObject, ExtractEnumKeys, ExtractEnumValues, ExtractObjects, FalsyValues, Fn, HasKey, HasSpecificKey, IfEquals, IndexKeys, IsAny, IsArray, IsEmptyArray, IsFunction, IsObject, IsObjectEmpty, IsPartial, IsUnknown, KeyOfByValue, LiteralUnion, Maybe, MaybeArray, MaybeFalsy, MaybeFn, MaybePromise, MaybeValues, NonReadonly, NonUndefined, NotMaybe, NotNullable, Nullable, OmitByValue, OverrideKey, Params, PartialIf, PartialKeys, PickByValue, Primitive, ReadonlyKeys, RecordEntries, RenameKey, RequiredKeys, UnionToIntersection, Unpromise, UpperFirst, ValueOf, WithRequired, WritableKeys };
457
+ export type { AllPropertiesOptional, AnyBoolean, AnyFunction, AnyNumber, AnyObject, AnyPrimitive, AnyString, BrowserNativeObject, Class, CopyObject, DeepPartial, Defined, Dict, EmptyObject, ExtractEnumKeys, ExtractEnumValues, ExtractObjects, FalsyValues, Fn, HasKey, HasSpecificKey, IfEquals, IndexKeys, IsAny, IsArray, IsEmptyArray, IsFunction, IsObject, IsObjectEmpty, IsPartial, IsUnknown, KeyOfByValue, LiteralUnion, Maybe, MaybeArray, MaybeFalsy, MaybeFn, MaybeKeys, MaybePromise, MaybeValues, NonReadonly, NonUndefined, NotMaybe, NotNullable, Nullable, OmitByValue, OverrideKey, Params, PartialIf, PartialKeys, PickByValue, Primitive, ReadonlyKeys, RecordEntries, RenameKey, RequiredKeys, UnionToIntersection, Unpromise, UpperFirst, ValueOf, WithRequired, WritableKeys };
package/types.global.d.ts CHANGED
@@ -50,6 +50,12 @@ type NotNullable<T> = Exclude<T, null>;
50
50
  * @returns Record with any keys and any values
51
51
  */
52
52
  type AnyObject = Record<keyof any, any>;
53
+ /**
54
+ * Represents dictionary with any keys and expecting values;
55
+ *
56
+ * @returns Record with any keys and values
57
+ */
58
+ type Dict<TValues = any, TKeys extends keyof any = keyof any> = Record<TKeys, TValues>;
53
59
  /**
54
60
  * Represents an empty object with no properties.
55
61
  *
@@ -134,6 +140,16 @@ type DeepPartial<T> = T extends BrowserNativeObject ? T : {
134
140
  * @returns A type with specified keys optional and others required
135
141
  */
136
142
  type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
143
+ /**
144
+ * Makes specified keys of a type possibly Maybe<T> while keeping the rest required.
145
+ *
146
+ * @template T - The original type
147
+ * @template TMaybeKeys - The keys to make possibly Maybe<T>
148
+ * @returns A type with specified keys possibly Maybe<T> and others required
149
+ */
150
+ type MaybeKeys<T, TMaybeKeys extends keyof T> = {
151
+ [K in keyof T]: K extends TMaybeKeys ? Maybe<T[K]> : T[K];
152
+ };
137
153
  /**
138
154
  * Makes specified keys of a type required while keeping the rest optional.
139
155
  *