inferred-types 0.55.1 → 0.55.2

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.
@@ -15908,7 +15908,7 @@ declare function getYesterday(): Iso8601Date$1<"explicit">;
15908
15908
  */
15909
15909
  declare function isLeapYear(val: NumberLike$1 | Record<string, any> | Date | number): boolean;
15910
15910
 
15911
- type Returns$2<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;
15911
+ type Returns$4<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;
15912
15912
  /**
15913
15913
  * Takes an object definition where the values are either
15914
15914
  * `SimpleToken` representations of a type or a `ShapeCallback`.
@@ -15916,7 +15916,7 @@ type Returns$2<T extends DefineObject$1, P extends readonly (keyof T & string)[]
15916
15916
  * In both cases the runtime type is left unchanged but the
15917
15917
  * type is converted to represent the designed object shape.
15918
15918
  */
15919
- declare function defineObject<T extends DefineObject$1, P extends readonly (keyof T & string)[]>(defn: T, ..._optProps: P): Returns$2<T, P>;
15919
+ declare function defineObject<T extends DefineObject$1, P extends readonly (keyof T & string)[]>(defn: T, ..._optProps: P): Returns$4<T, P>;
15920
15920
 
15921
15921
  /**
15922
15922
  * **entries**
@@ -16594,14 +16594,14 @@ type _Index<T extends readonly string[], IF, ELSE, Results extends readonly unkn
16594
16594
  ...Results,
16595
16595
  If$1<Extends$1<T, LowerAlphaChar$1>, IF, ELSE>
16596
16596
  ]>;
16597
- type Returns$1<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;
16597
+ type Returns$3<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;
16598
16598
  /**
16599
16599
  * **ifLowercaseChar**(ch)
16600
16600
  *
16601
16601
  * Tests whether a passed in character is lowercase and then uses the appropriate callback to
16602
16602
  * mutate the value.
16603
16603
  */
16604
- 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$1<T, IF, ELSE>;
16604
+ 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$3<T, IF, ELSE>;
16605
16605
 
16606
16606
  type Convert$6<T, IF, ELSE> = If$1<Extends$1<T, UpperAlphaChar$1>, IF, ELSE>;
16607
16607
  /**
@@ -16657,7 +16657,7 @@ interface GetInferenceProps<TPattern extends string> {
16657
16657
  typeWide: WiderTypeLiteral<TPattern>;
16658
16658
  }
16659
16659
  type GetInference<TPattern extends string> = (<T extends string>(test: T) => T extends TypeLiteral<TPattern> ? Shape$2<TPattern> : false | Shape$2<TPattern>) & GetInferenceProps<TPattern>;
16660
- type Returns$3<T extends string> = IsDynamic<T> extends true ? GetInference<T> : never;
16660
+ type Returns$2<T extends string> = IsDynamic<T> extends true ? GetInference<T> : never;
16661
16661
  /**
16662
16662
  * **infer**`(pattern)`
16663
16663
  *
@@ -16677,7 +16677,7 @@ type Returns$3<T extends string> = IsDynamic<T> extends true ? GetInference<T> :
16677
16677
  * const {foo} = matcher("foo-bar");
16678
16678
  * ```
16679
16679
  */
16680
- declare function infer<TTempl extends string>(inference: TTempl): Returns$3<TTempl>;
16680
+ declare function infer<TTempl extends string>(inference: TTempl): Returns$2<TTempl>;
16681
16681
 
16682
16682
  /**
16683
16683
  * Takes an object as input --which has an `id` property and returns it as the same
@@ -16917,13 +16917,14 @@ declare function stripBefore<TContent extends string, TBreak extends string>(con
16917
16917
  */
16918
16918
  declare function stripChars<TContent extends string, TRetain extends readonly string[]>(content: TContent, ...strip: TRetain): StripChars$1<TContent, TRetain[number]>;
16919
16919
 
16920
+ type Returns$1<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;
16920
16921
  /**
16921
16922
  * **stripLeading**(content, ...strip)
16922
16923
  *
16923
16924
  * Runtime utility which strips of a leading substring from the
16924
16925
  * primary content if it exists and leaves content unchanged otherwise.
16925
16926
  */
16926
- declare function stripLeading<T extends string | number, U extends readonly (string | number)[]>(content: T, ...strip: U): StripLeading$1<T, TupleToUnion$1<U>>;
16927
+ declare function stripLeading<T extends string | number | undefined, U extends readonly (string | number)[]>(content: T, ...strip: U): Returns$1<T, U>;
16927
16928
 
16928
16929
  type StripSurroundConfigured<TStrip extends readonly (string | number)[]> = <TInput extends string | number>(input: TInput) => StripSurround$1<TInput, TStrip[number]>;
16929
16930
  /**
@@ -16943,13 +16944,14 @@ type StripSurroundConfigured<TStrip extends readonly (string | number)[]> = <TIn
16943
16944
  */
16944
16945
  declare function stripSurround<TChars extends readonly (number | string)[]>(...chars: TChars): StripSurroundConfigured<TChars>;
16945
16946
 
16947
+ type Returns$5<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;
16946
16948
  /**
16947
16949
  * **stripTrailing**(content, strip)
16948
16950
  *
16949
16951
  * Runtime utility which ensures that last part of a string has substring
16950
16952
  * removed if it exists and that strong typing is preserved.
16951
16953
  */
16952
- declare function stripTrailing<T extends string | number, U extends readonly (string | number)[]>(content: T, ...strip: U): StripTrailing$1<T, TupleToUnion$1<U>>;
16954
+ declare function stripTrailing<T extends string | number | undefined, U extends readonly (string | number)[]>(content: T, ...strip: U): Returns$5<T, U>;
16953
16955
 
16954
16956
  /**
16955
16957
  * **stripUntil**`(content, ...until)`
@@ -5418,6 +5418,9 @@ function intersect(value, _intersectedWith) {
5418
5418
  return value;
5419
5419
  }
5420
5420
  function stripTrailing(content, ...strip2) {
5421
+ if (isUndefined(content)) {
5422
+ return void 0;
5423
+ }
5421
5424
  let output = String(content);
5422
5425
  for (const s of strip2) {
5423
5426
  if (output.endsWith(String(s))) {
@@ -6574,6 +6577,9 @@ function stripChars(content, ...strip2) {
6574
6577
  return chars.filter((c) => !strip2.includes(c)).join("");
6575
6578
  }
6576
6579
  function stripLeading(content, ...strip2) {
6580
+ if (isUndefined(content)) {
6581
+ return void 0;
6582
+ }
6577
6583
  let output = String(content);
6578
6584
  for (const s of strip2) {
6579
6585
  if (output.startsWith(String(s))) {