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.
@@ -8648,7 +8648,7 @@ type InvalidNever$1 = Throw$1<"invalid-never", `The value of T when calling IsWi
8648
8648
  type IsWideType$1<T, TNever = InvalidNever$1> = [IsNever$1<T>] extends [true] ? TNever : [T] extends [ErrorCondition$1] ? ProxyError$1<T, "IsWideType"> : IsWideScalar$1<T> extends true ? true : IsWideContainer$1<T> extends true ? true : IsWideUnion$1<T> extends true ? true : false;
8649
8649
 
8650
8650
  type Process$1k$1<T extends readonly unknown[]> = {
8651
- [K in keyof T]: IsWideType$1<T[K]>;
8651
+ [K in keyof T]: IsWideType$1<T[K]> extends true ? true : Or$1<[IsUndefined$1<T[K]>, IsNull$1<T[K]>]> extends true ? true : false;
8652
8652
  };
8653
8653
  /**
8654
8654
  * **IsWideUnion**`<T>`
@@ -16210,7 +16210,7 @@ declare function getYesterday(): Iso8601Date$1<"explicit">;
16210
16210
  */
16211
16211
  declare function isLeapYear(val: NumberLike$1 | Record<string, any> | Date | number): boolean;
16212
16212
 
16213
- type Returns$5<T extends DefineObject$1, P extends readonly (keyof T & string)[]> = P["length"] extends 0 ? FromDefineObject$1<T> : MakeKeysOptional$1<T, P> extends DefineObject$1 ? FromDefineObject$1<MakeKeysOptional$1<T, P>> : never;
16213
+ type Returns$6<T extends DefineObject$1, P extends readonly (keyof T & string)[]> = P["length"] extends 0 ? FromDefineObject$1<T> : MakeKeysOptional$1<T, P> extends DefineObject$1 ? FromDefineObject$1<MakeKeysOptional$1<T, P>> : never;
16214
16214
  /**
16215
16215
  * Takes an object definition where the values are either
16216
16216
  * `SimpleToken` representations of a type or a `ShapeCallback`.
@@ -16218,7 +16218,7 @@ type Returns$5<T extends DefineObject$1, P extends readonly (keyof T & string)[]
16218
16218
  * In both cases the runtime type is left unchanged but the
16219
16219
  * type is converted to represent the designed object shape.
16220
16220
  */
16221
- declare function defineObject<T extends DefineObject$1, P extends readonly (keyof T & string)[]>(defn: T, ..._optProps: P): Returns$5<T, P>;
16221
+ declare function defineObject<T extends DefineObject$1, P extends readonly (keyof T & string)[]>(defn: T, ..._optProps: P): Returns$6<T, P>;
16222
16222
 
16223
16223
  /**
16224
16224
  * **entries**
@@ -16916,14 +16916,14 @@ type _Index<T extends readonly string[], IF, ELSE, Results extends readonly unkn
16916
16916
  ...Results,
16917
16917
  If$1<Extends$1<T, LowerAlphaChar$1>, IF, ELSE>
16918
16918
  ]>;
16919
- type Returns$4<T extends string | readonly string[], IF, ELSE> = T extends string ? If$1<Extends$1<T, LowerAlphaChar$1>, IF, ELSE> : T extends readonly string[] ? _Index<T, IF, ELSE> : never;
16919
+ type Returns$5<T extends string | readonly string[], IF, ELSE> = T extends string ? If$1<Extends$1<T, LowerAlphaChar$1>, IF, ELSE> : T extends readonly string[] ? _Index<T, IF, ELSE> : never;
16920
16920
  /**
16921
16921
  * **ifLowercaseChar**(ch)
16922
16922
  *
16923
16923
  * Tests whether a passed in character is lowercase and then uses the appropriate callback to
16924
16924
  * mutate the value.
16925
16925
  */
16926
- 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>;
16926
+ 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>;
16927
16927
 
16928
16928
  type Convert$6<T, IF, ELSE> = If$1<Extends$1<T, UpperAlphaChar$1>, IF, ELSE>;
16929
16929
  /**
@@ -16979,7 +16979,7 @@ interface GetInferenceProps<TPattern extends string> {
16979
16979
  typeWide: WiderTypeLiteral<TPattern>;
16980
16980
  }
16981
16981
  type GetInference<TPattern extends string> = (<T extends string>(test: T) => T extends TypeLiteral<TPattern> ? Shape$2<TPattern> : false | Shape$2<TPattern>) & GetInferenceProps<TPattern>;
16982
- type Returns$3<T extends string> = IsDynamic<T> extends true ? GetInference<T> : never;
16982
+ type Returns$4<T extends string> = IsDynamic<T> extends true ? GetInference<T> : never;
16983
16983
  /**
16984
16984
  * **infer**`(pattern)`
16985
16985
  *
@@ -16999,7 +16999,7 @@ type Returns$3<T extends string> = IsDynamic<T> extends true ? GetInference<T> :
16999
16999
  * const {foo} = matcher("foo-bar");
17000
17000
  * ```
17001
17001
  */
17002
- declare function infer<TTempl extends string>(inference: TTempl): Returns$3<TTempl>;
17002
+ declare function infer<TTempl extends string>(inference: TTempl): Returns$4<TTempl>;
17003
17003
 
17004
17004
  /**
17005
17005
  * Takes an object as input --which has an `id` property and returns it as the same
@@ -17239,14 +17239,14 @@ declare function stripBefore<TContent extends string, TBreak extends string>(con
17239
17239
  */
17240
17240
  declare function stripChars<TContent extends string, TRetain extends readonly string[]>(content: TContent, ...strip: TRetain): StripChars$1<TContent, TRetain[number]>;
17241
17241
 
17242
- type Returns$2<T extends string | number | undefined, U extends readonly (string | number)[]> = T extends undefined ? undefined : T extends string | number ? StripLeading$1<T, TupleToUnion$1<U>> : never;
17242
+ type Returns$3<T extends string | number | undefined, U extends readonly (string | number)[]> = T extends undefined ? undefined : T extends string | number ? StripLeading$1<T, TupleToUnion$1<U>> : never;
17243
17243
  /**
17244
17244
  * **stripLeading**(content, ...strip)
17245
17245
  *
17246
17246
  * Runtime utility which strips of a leading substring from the
17247
17247
  * primary content if it exists and leaves content unchanged otherwise.
17248
17248
  */
17249
- declare function stripLeading<T extends string | number | undefined, U extends readonly (string | number)[]>(content: T, ...strip: U): Returns$2<T, U>;
17249
+ declare function stripLeading<T extends string | number | undefined, U extends readonly (string | number)[]>(content: T, ...strip: U): Returns$3<T, U>;
17250
17250
 
17251
17251
  type StripSurroundConfigured<TStrip extends readonly (string | number)[]> = <TInput extends string | number>(input: TInput) => StripSurround$1<TInput, TStrip[number]>;
17252
17252
  /**
@@ -17266,14 +17266,14 @@ type StripSurroundConfigured<TStrip extends readonly (string | number)[]> = <TIn
17266
17266
  */
17267
17267
  declare function stripSurround<TChars extends readonly (number | string)[]>(...chars: TChars): StripSurroundConfigured<TChars>;
17268
17268
 
17269
- type Returns$1<T extends string | number | undefined, U extends readonly (string | number)[]> = T extends undefined ? undefined : T extends string | number ? StripTrailing$1<T, TupleToUnion$1<U>> : never;
17269
+ type Returns$2<T extends string | number | undefined, U extends readonly (string | number)[]> = T extends undefined ? undefined : T extends string | number ? StripTrailing$1<T, TupleToUnion$1<U>> : never;
17270
17270
  /**
17271
17271
  * **stripTrailing**(content, strip)
17272
17272
  *
17273
17273
  * Runtime utility which ensures that last part of a string has substring
17274
17274
  * removed if it exists and that strong typing is preserved.
17275
17275
  */
17276
- declare function stripTrailing<T extends string | number | undefined, U extends readonly (string | number)[]>(content: T, ...strip: U): Returns$1<T, U>;
17276
+ declare function stripTrailing<T extends string | number | undefined, U extends readonly (string | number)[]>(content: T, ...strip: U): Returns$2<T, U>;
17277
17277
 
17278
17278
  /**
17279
17279
  * **stripUntil**`(content, ...until)`
@@ -18042,7 +18042,7 @@ interface SortApi<O extends readonly string[]> {
18042
18042
  done: () => O;
18043
18043
  }
18044
18044
  type ToKeyValueSort<O extends readonly string[]> = <TCb extends SortApi<O>>(cb: TCb) => unknown;
18045
- type Returns$6<T extends AnyObject$1, S extends ToKeyValueSort<SKeys$1<T>> | undefined> = S extends undefined ? ToKv$1<T> : S extends ToKeyValueSort<SKeys$1<T>> ? HandleDoneFn$1<ReturnType<S>> extends readonly (keyof T & string)[] ? ToKv$1<T, HandleDoneFn$1<ReturnType<S>>> : never : never;
18045
+ type Returns$1<T extends AnyObject$1, S extends ToKeyValueSort<SKeys$1<T>> | undefined> = S extends undefined ? ToKv$1<T> : S extends ToKeyValueSort<SKeys$1<T>> ? HandleDoneFn$1<ReturnType<S>> extends readonly (keyof T & string)[] ? ToKv$1<T, HandleDoneFn$1<ReturnType<S>>> : never : never;
18046
18046
  /**
18047
18047
  * **toKeyValue**`(obj)` -> tuple
18048
18048
  *
@@ -18066,7 +18066,7 @@ type Returns$6<T extends AnyObject$1, S extends ToKeyValueSort<SKeys$1<T>> | und
18066
18066
  */
18067
18067
  declare function toKeyValue<T extends {
18068
18068
  [key: string]: N;
18069
- }, N extends Narrowable$1, S extends ToKeyValueSort<SKeys$1<T>> | undefined>(obj: T, sort?: S): Returns$6<T, S>;
18069
+ }, N extends Narrowable$1, S extends ToKeyValueSort<SKeys$1<T>> | undefined>(obj: T, sort?: S): Returns$1<T, S>;
18070
18070
 
18071
18071
  /**
18072
18072
  * **toNumber**(value)
@@ -18411,13 +18411,14 @@ declare function endsWith<T extends string>(endingIn: T): EndingWithTypeGuard<T>
18411
18411
  /**
18412
18412
  * A TypeGuard which was generated from `isEqual()` runtime util.
18413
18413
  */
18414
- type EqualTo<T extends Narrowable$1> = TypeGuard$1<T>;
18414
+ type EqualTo<_A> = <TValue extends Narrowable$1>(value: TValue) => boolean;
18415
+ type Returns$7<TVal, TBase extends readonly Narrowable$1[]> = IsUnion$1<TVal> extends true ? TVal & TBase[number] : TVal extends TBase[number] ? TVal : IsUnion$1<TVal> extends true ? TVal : never;
18415
18416
  /**
18416
18417
  * **isEqual**(compareTo)(value)
18417
18418
  *
18418
18419
  * Higher order type guard to detect whether two values are equal
18419
18420
  */
18420
- declare function isEqual<TBase extends Narrowable$1>(base: TBase): EqualTo<TBase>;
18421
+ declare function isEqual<TBase extends readonly N[], N extends Narrowable$1>(...base: TBase): <TVal extends Narrowable$1>(value: TVal) => value is Returns$7<TVal, TBase>;
18421
18422
 
18422
18423
  /**
18423
18424
  * **ifLength**(len) => (value) => boolean
@@ -25471,7 +25472,7 @@ type InvalidNever = Throw<"invalid-never", `The value of T when calling IsWideTy
25471
25472
  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;
25472
25473
 
25473
25474
  type Process$1k<T extends readonly unknown[]> = {
25474
- [K in keyof T]: IsWideType<T[K]>;
25475
+ [K in keyof T]: IsWideType<T[K]> extends true ? true : Or<[IsUndefined<T[K]>, IsNull<T[K]>]> extends true ? true : false;
25475
25476
  };
25476
25477
  /**
25477
25478
  * **IsWideUnion**`<T>`
@@ -5702,15 +5702,20 @@ function endsWith(endingIn2) {
5702
5702
  return isString(val) ? !!val.endsWith(endingIn2) : isNumber(val) ? !!String(val).endsWith(endingIn2) : false;
5703
5703
  };
5704
5704
  }
5705
- function isEqual(base) {
5706
- return (value) => isSameTypeOf(base)(value) ? value === base : false;
5705
+ function compare(base) {
5706
+ return (value) => {
5707
+ return base.includes(value);
5708
+ };
5709
+ }
5710
+ function isEqual(...base) {
5711
+ return compare(base);
5707
5712
  }
5708
5713
  function isLength(value, len) {
5709
5714
  return isArray(value) ? !!isEqual(value.length)(len) : isString(value) ? !!isEqual(value.length)(len) : isObject(value) ? !!isEqual(keysOf(value))(len) : false;
5710
5715
  }
5711
5716
  function isSameTypeOf(base) {
5712
- return (compare) => {
5713
- return typeof base === typeof compare;
5717
+ return (compare2) => {
5718
+ return typeof base === typeof compare2;
5714
5719
  };
5715
5720
  }
5716
5721
  function isTuple(...tuple3) {