inferred-types 0.55.14 → 0.55.15

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.
@@ -4553,7 +4553,7 @@ type InvalidNever = Throw<"invalid-never", `The value of T when calling IsWideTy
4553
4553
  type IsWideType<T, TNever = InvalidNever> = [IsNever<T>] extends [true] ? TNever : [T] extends [ErrorCondition] ? ProxyError<T, "IsWideType"> : IsWideScalar<T> extends true ? true : IsWideContainer<T> extends true ? true : IsWideUnion<T> extends true ? true : false;
4554
4554
 
4555
4555
  type Process$1k<T extends readonly unknown[]> = {
4556
- [K in keyof T]: IsWideType<T[K]>;
4556
+ [K in keyof T]: IsWideType<T[K]> extends true ? true : Or<[IsUndefined<T[K]>, IsNull<T[K]>]> extends true ? true : false;
4557
4557
  };
4558
4558
  /**
4559
4559
  * **IsWideUnion**`<T>`
@@ -12115,7 +12115,7 @@ declare function getYesterday(): Iso8601Date<"explicit">;
12115
12115
  */
12116
12116
  declare function isLeapYear(val: NumberLike | Record<string, any> | Date | number): boolean;
12117
12117
 
12118
- type Returns$5<T extends DefineObject, P extends readonly (keyof T & string)[]> = P["length"] extends 0 ? FromDefineObject<T> : MakeKeysOptional<T, P> extends DefineObject ? FromDefineObject<MakeKeysOptional<T, P>> : never;
12118
+ type Returns$6<T extends DefineObject, P extends readonly (keyof T & string)[]> = P["length"] extends 0 ? FromDefineObject<T> : MakeKeysOptional<T, P> extends DefineObject ? FromDefineObject<MakeKeysOptional<T, P>> : never;
12119
12119
  /**
12120
12120
  * Takes an object definition where the values are either
12121
12121
  * `SimpleToken` representations of a type or a `ShapeCallback`.
@@ -12123,7 +12123,7 @@ type Returns$5<T extends DefineObject, P extends readonly (keyof T & string)[]>
12123
12123
  * In both cases the runtime type is left unchanged but the
12124
12124
  * type is converted to represent the designed object shape.
12125
12125
  */
12126
- declare function defineObject<T extends DefineObject, P extends readonly (keyof T & string)[]>(defn: T, ..._optProps: P): Returns$5<T, P>;
12126
+ declare function defineObject<T extends DefineObject, P extends readonly (keyof T & string)[]>(defn: T, ..._optProps: P): Returns$6<T, P>;
12127
12127
 
12128
12128
  /**
12129
12129
  * **entries**
@@ -12821,14 +12821,14 @@ type _Index<T extends readonly string[], IF, ELSE, Results extends readonly unkn
12821
12821
  ...Results,
12822
12822
  If<Extends<T, LowerAlphaChar>, IF, ELSE>
12823
12823
  ]>;
12824
- type Returns$4<T extends string | readonly string[], IF, ELSE> = T extends string ? If<Extends<T, LowerAlphaChar>, IF, ELSE> : T extends readonly string[] ? _Index<T, IF, ELSE> : never;
12824
+ type Returns$5<T extends string | readonly string[], IF, ELSE> = T extends string ? If<Extends<T, LowerAlphaChar>, IF, ELSE> : T extends readonly string[] ? _Index<T, IF, ELSE> : never;
12825
12825
  /**
12826
12826
  * **ifLowercaseChar**(ch)
12827
12827
  *
12828
12828
  * Tests whether a passed in character is lowercase and then uses the appropriate callback to
12829
12829
  * mutate the value.
12830
12830
  */
12831
- declare function ifLowercaseChar<T extends string, IF, ELSE>(ch: T, callbackForMatch: <V extends T>(v: V) => IF, callbackForNoMatch: <V extends T>(v: V) => ELSE): Returns$4<T, IF, ELSE>;
12831
+ declare function ifLowercaseChar<T extends string, IF, ELSE>(ch: T, callbackForMatch: <V extends T>(v: V) => IF, callbackForNoMatch: <V extends T>(v: V) => ELSE): Returns$5<T, IF, ELSE>;
12832
12832
 
12833
12833
  type Convert<T, IF, ELSE> = If<Extends<T, UpperAlphaChar>, IF, ELSE>;
12834
12834
  /**
@@ -12884,7 +12884,7 @@ interface GetInferenceProps<TPattern extends string> {
12884
12884
  typeWide: WiderTypeLiteral<TPattern>;
12885
12885
  }
12886
12886
  type GetInference<TPattern extends string> = (<T extends string>(test: T) => T extends TypeLiteral<TPattern> ? Shape<TPattern> : false | Shape<TPattern>) & GetInferenceProps<TPattern>;
12887
- type Returns$3<T extends string> = IsDynamic<T> extends true ? GetInference<T> : never;
12887
+ type Returns$4<T extends string> = IsDynamic<T> extends true ? GetInference<T> : never;
12888
12888
  /**
12889
12889
  * **infer**`(pattern)`
12890
12890
  *
@@ -12904,7 +12904,7 @@ type Returns$3<T extends string> = IsDynamic<T> extends true ? GetInference<T> :
12904
12904
  * const {foo} = matcher("foo-bar");
12905
12905
  * ```
12906
12906
  */
12907
- declare function infer<TTempl extends string>(inference: TTempl): Returns$3<TTempl>;
12907
+ declare function infer<TTempl extends string>(inference: TTempl): Returns$4<TTempl>;
12908
12908
 
12909
12909
  /**
12910
12910
  * Takes an object as input --which has an `id` property and returns it as the same
@@ -13144,14 +13144,14 @@ declare function stripBefore<TContent extends string, TBreak extends string>(con
13144
13144
  */
13145
13145
  declare function stripChars<TContent extends string, TRetain extends readonly string[]>(content: TContent, ...strip: TRetain): StripChars<TContent, TRetain[number]>;
13146
13146
 
13147
- type Returns$2<T extends string | number | undefined, U extends readonly (string | number)[]> = T extends undefined ? undefined : T extends string | number ? StripLeading<T, TupleToUnion<U>> : never;
13147
+ type Returns$3<T extends string | number | undefined, U extends readonly (string | number)[]> = T extends undefined ? undefined : T extends string | number ? StripLeading<T, TupleToUnion<U>> : never;
13148
13148
  /**
13149
13149
  * **stripLeading**(content, ...strip)
13150
13150
  *
13151
13151
  * Runtime utility which strips of a leading substring from the
13152
13152
  * primary content if it exists and leaves content unchanged otherwise.
13153
13153
  */
13154
- declare function stripLeading<T extends string | number | undefined, U extends readonly (string | number)[]>(content: T, ...strip: U): Returns$2<T, U>;
13154
+ declare function stripLeading<T extends string | number | undefined, U extends readonly (string | number)[]>(content: T, ...strip: U): Returns$3<T, U>;
13155
13155
 
13156
13156
  type StripSurroundConfigured<TStrip extends readonly (string | number)[]> = <TInput extends string | number>(input: TInput) => StripSurround<TInput, TStrip[number]>;
13157
13157
  /**
@@ -13171,14 +13171,14 @@ type StripSurroundConfigured<TStrip extends readonly (string | number)[]> = <TIn
13171
13171
  */
13172
13172
  declare function stripSurround<TChars extends readonly (number | string)[]>(...chars: TChars): StripSurroundConfigured<TChars>;
13173
13173
 
13174
- type Returns$1<T extends string | number | undefined, U extends readonly (string | number)[]> = T extends undefined ? undefined : T extends string | number ? StripTrailing<T, TupleToUnion<U>> : never;
13174
+ type Returns$2<T extends string | number | undefined, U extends readonly (string | number)[]> = T extends undefined ? undefined : T extends string | number ? StripTrailing<T, TupleToUnion<U>> : never;
13175
13175
  /**
13176
13176
  * **stripTrailing**(content, strip)
13177
13177
  *
13178
13178
  * Runtime utility which ensures that last part of a string has substring
13179
13179
  * removed if it exists and that strong typing is preserved.
13180
13180
  */
13181
- declare function stripTrailing<T extends string | number | undefined, U extends readonly (string | number)[]>(content: T, ...strip: U): Returns$1<T, U>;
13181
+ declare function stripTrailing<T extends string | number | undefined, U extends readonly (string | number)[]>(content: T, ...strip: U): Returns$2<T, U>;
13182
13182
 
13183
13183
  /**
13184
13184
  * **stripUntil**`(content, ...until)`
@@ -13947,7 +13947,7 @@ interface SortApi<O extends readonly string[]> {
13947
13947
  done: () => O;
13948
13948
  }
13949
13949
  type ToKeyValueSort<O extends readonly string[]> = <TCb extends SortApi<O>>(cb: TCb) => unknown;
13950
- type Returns<T extends AnyObject, S extends ToKeyValueSort<SKeys<T>> | undefined> = S extends undefined ? ToKv<T> : S extends ToKeyValueSort<SKeys<T>> ? HandleDoneFn<ReturnType<S>> extends readonly (keyof T & string)[] ? ToKv<T, HandleDoneFn<ReturnType<S>>> : never : never;
13950
+ type Returns$1<T extends AnyObject, S extends ToKeyValueSort<SKeys<T>> | undefined> = S extends undefined ? ToKv<T> : S extends ToKeyValueSort<SKeys<T>> ? HandleDoneFn<ReturnType<S>> extends readonly (keyof T & string)[] ? ToKv<T, HandleDoneFn<ReturnType<S>>> : never : never;
13951
13951
  /**
13952
13952
  * **toKeyValue**`(obj)` -> tuple
13953
13953
  *
@@ -13971,7 +13971,7 @@ type Returns<T extends AnyObject, S extends ToKeyValueSort<SKeys<T>> | undefined
13971
13971
  */
13972
13972
  declare function toKeyValue<T extends {
13973
13973
  [key: string]: N;
13974
- }, N extends Narrowable, S extends ToKeyValueSort<SKeys<T>> | undefined>(obj: T, sort?: S): Returns<T, S>;
13974
+ }, N extends Narrowable, S extends ToKeyValueSort<SKeys<T>> | undefined>(obj: T, sort?: S): Returns$1<T, S>;
13975
13975
 
13976
13976
  /**
13977
13977
  * **toNumber**(value)
@@ -14316,13 +14316,14 @@ declare function endsWith<T extends string>(endingIn: T): EndingWithTypeGuard<T>
14316
14316
  /**
14317
14317
  * A TypeGuard which was generated from `isEqual()` runtime util.
14318
14318
  */
14319
- type EqualTo<T extends Narrowable> = TypeGuard<T>;
14319
+ type EqualTo<_A> = <TValue extends Narrowable>(value: TValue) => boolean;
14320
+ type Returns<TVal, TBase extends readonly Narrowable[]> = IsUnion<TVal> extends true ? TVal & TBase[number] : TVal extends TBase[number] ? TVal : IsUnion<TVal> extends true ? TVal : never;
14320
14321
  /**
14321
14322
  * **isEqual**(compareTo)(value)
14322
14323
  *
14323
14324
  * Higher order type guard to detect whether two values are equal
14324
14325
  */
14325
- declare function isEqual<TBase extends Narrowable>(base: TBase): EqualTo<TBase>;
14326
+ declare function isEqual<TBase extends readonly N[], N extends Narrowable>(...base: TBase): <TVal extends Narrowable>(value: TVal) => value is Returns<TVal, TBase>;
14326
14327
 
14327
14328
  /**
14328
14329
  * **ifLength**(len) => (value) => boolean
@@ -3334,8 +3334,13 @@ function endsWith(endingIn2) {
3334
3334
  }
3335
3335
 
3336
3336
  // src/type-guards/higher-order/isEqual.ts
3337
- function isEqual(base) {
3338
- return (value) => isSameTypeOf(base)(value) ? value === base : false;
3337
+ function compare(base) {
3338
+ return (value) => {
3339
+ return base.includes(value);
3340
+ };
3341
+ }
3342
+ function isEqual(...base) {
3343
+ return compare(base);
3339
3344
  }
3340
3345
 
3341
3346
  // src/type-guards/higher-order/isLength.ts
@@ -3345,8 +3350,8 @@ function isLength(value, len) {
3345
3350
 
3346
3351
  // src/type-guards/higher-order/isSameTypeOf.ts
3347
3352
  function isSameTypeOf(base) {
3348
- return (compare) => {
3349
- return typeof base === typeof compare;
3353
+ return (compare2) => {
3354
+ return typeof base === typeof compare2;
3350
3355
  };
3351
3356
  }
3352
3357