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.
- package/modules/constants/dist/index.cjs +3 -3
- package/modules/inferred-types/dist/index.cjs +9 -3
- package/modules/inferred-types/dist/index.cjs.map +1 -1
- package/modules/inferred-types/dist/index.d.ts +10 -8
- package/modules/inferred-types/dist/index.js +6 -0
- package/modules/inferred-types/dist/index.js.map +1 -1
- package/modules/runtime/dist/index.cjs +9 -3
- package/modules/runtime/dist/index.cjs.map +1 -1
- package/modules/runtime/dist/index.d.ts +10 -8
- package/modules/runtime/dist/index.js +6 -0
- package/modules/runtime/dist/index.js.map +1 -1
- package/modules/types/dist/index.cjs +3 -3
- package/package.json +15 -13
|
@@ -11813,7 +11813,7 @@ declare function getYesterday(): Iso8601Date<"explicit">;
|
|
|
11813
11813
|
*/
|
|
11814
11814
|
declare function isLeapYear(val: NumberLike | Record<string, any> | Date | number): boolean;
|
|
11815
11815
|
|
|
11816
|
-
type Returns$
|
|
11816
|
+
type Returns$4<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;
|
|
11817
11817
|
/**
|
|
11818
11818
|
* Takes an object definition where the values are either
|
|
11819
11819
|
* `SimpleToken` representations of a type or a `ShapeCallback`.
|
|
@@ -11821,7 +11821,7 @@ type Returns$2<T extends DefineObject, P extends readonly (keyof T & string)[]>
|
|
|
11821
11821
|
* In both cases the runtime type is left unchanged but the
|
|
11822
11822
|
* type is converted to represent the designed object shape.
|
|
11823
11823
|
*/
|
|
11824
|
-
declare function defineObject<T extends DefineObject, P extends readonly (keyof T & string)[]>(defn: T, ..._optProps: P): Returns$
|
|
11824
|
+
declare function defineObject<T extends DefineObject, P extends readonly (keyof T & string)[]>(defn: T, ..._optProps: P): Returns$4<T, P>;
|
|
11825
11825
|
|
|
11826
11826
|
/**
|
|
11827
11827
|
* **entries**
|
|
@@ -12499,14 +12499,14 @@ type _Index<T extends readonly string[], IF, ELSE, Results extends readonly unkn
|
|
|
12499
12499
|
...Results,
|
|
12500
12500
|
If<Extends<T, LowerAlphaChar>, IF, ELSE>
|
|
12501
12501
|
]>;
|
|
12502
|
-
type Returns$
|
|
12502
|
+
type Returns$3<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;
|
|
12503
12503
|
/**
|
|
12504
12504
|
* **ifLowercaseChar**(ch)
|
|
12505
12505
|
*
|
|
12506
12506
|
* Tests whether a passed in character is lowercase and then uses the appropriate callback to
|
|
12507
12507
|
* mutate the value.
|
|
12508
12508
|
*/
|
|
12509
|
-
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$
|
|
12509
|
+
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>;
|
|
12510
12510
|
|
|
12511
12511
|
type Convert<T, IF, ELSE> = If<Extends<T, UpperAlphaChar>, IF, ELSE>;
|
|
12512
12512
|
/**
|
|
@@ -12562,7 +12562,7 @@ interface GetInferenceProps<TPattern extends string> {
|
|
|
12562
12562
|
typeWide: WiderTypeLiteral<TPattern>;
|
|
12563
12563
|
}
|
|
12564
12564
|
type GetInference<TPattern extends string> = (<T extends string>(test: T) => T extends TypeLiteral<TPattern> ? Shape<TPattern> : false | Shape<TPattern>) & GetInferenceProps<TPattern>;
|
|
12565
|
-
type Returns<T extends string> = IsDynamic<T> extends true ? GetInference<T> : never;
|
|
12565
|
+
type Returns$2<T extends string> = IsDynamic<T> extends true ? GetInference<T> : never;
|
|
12566
12566
|
/**
|
|
12567
12567
|
* **infer**`(pattern)`
|
|
12568
12568
|
*
|
|
@@ -12582,7 +12582,7 @@ type Returns<T extends string> = IsDynamic<T> extends true ? GetInference<T> : n
|
|
|
12582
12582
|
* const {foo} = matcher("foo-bar");
|
|
12583
12583
|
* ```
|
|
12584
12584
|
*/
|
|
12585
|
-
declare function infer<TTempl extends string>(inference: TTempl): Returns<TTempl>;
|
|
12585
|
+
declare function infer<TTempl extends string>(inference: TTempl): Returns$2<TTempl>;
|
|
12586
12586
|
|
|
12587
12587
|
/**
|
|
12588
12588
|
* Takes an object as input --which has an `id` property and returns it as the same
|
|
@@ -12822,13 +12822,14 @@ declare function stripBefore<TContent extends string, TBreak extends string>(con
|
|
|
12822
12822
|
*/
|
|
12823
12823
|
declare function stripChars<TContent extends string, TRetain extends readonly string[]>(content: TContent, ...strip: TRetain): StripChars<TContent, TRetain[number]>;
|
|
12824
12824
|
|
|
12825
|
+
type Returns$1<T extends string | number | undefined, U extends readonly (string | number)[]> = T extends undefined ? undefined : T extends string | number ? StripLeading<T, TupleToUnion<U>> : never;
|
|
12825
12826
|
/**
|
|
12826
12827
|
* **stripLeading**(content, ...strip)
|
|
12827
12828
|
*
|
|
12828
12829
|
* Runtime utility which strips of a leading substring from the
|
|
12829
12830
|
* primary content if it exists and leaves content unchanged otherwise.
|
|
12830
12831
|
*/
|
|
12831
|
-
declare function stripLeading<T extends string | number, U extends readonly (string | number)[]>(content: T, ...strip: U):
|
|
12832
|
+
declare function stripLeading<T extends string | number | undefined, U extends readonly (string | number)[]>(content: T, ...strip: U): Returns$1<T, U>;
|
|
12832
12833
|
|
|
12833
12834
|
type StripSurroundConfigured<TStrip extends readonly (string | number)[]> = <TInput extends string | number>(input: TInput) => StripSurround<TInput, TStrip[number]>;
|
|
12834
12835
|
/**
|
|
@@ -12848,13 +12849,14 @@ type StripSurroundConfigured<TStrip extends readonly (string | number)[]> = <TIn
|
|
|
12848
12849
|
*/
|
|
12849
12850
|
declare function stripSurround<TChars extends readonly (number | string)[]>(...chars: TChars): StripSurroundConfigured<TChars>;
|
|
12850
12851
|
|
|
12852
|
+
type Returns<T extends string | number | undefined, U extends readonly (string | number)[]> = T extends undefined ? undefined : T extends string | number ? StripTrailing<T, TupleToUnion<U>> : never;
|
|
12851
12853
|
/**
|
|
12852
12854
|
* **stripTrailing**(content, strip)
|
|
12853
12855
|
*
|
|
12854
12856
|
* Runtime utility which ensures that last part of a string has substring
|
|
12855
12857
|
* removed if it exists and that strong typing is preserved.
|
|
12856
12858
|
*/
|
|
12857
|
-
declare function stripTrailing<T extends string | number, U extends readonly (string | number)[]>(content: T, ...strip: U):
|
|
12859
|
+
declare function stripTrailing<T extends string | number | undefined, U extends readonly (string | number)[]>(content: T, ...strip: U): Returns<T, U>;
|
|
12858
12860
|
|
|
12859
12861
|
/**
|
|
12860
12862
|
* **stripUntil**`(content, ...until)`
|
|
@@ -3054,6 +3054,9 @@ function intersect(value, _intersectedWith) {
|
|
|
3054
3054
|
|
|
3055
3055
|
// src/literals/stripTrailing.ts
|
|
3056
3056
|
function stripTrailing(content, ...strip2) {
|
|
3057
|
+
if (isUndefined(content)) {
|
|
3058
|
+
return void 0;
|
|
3059
|
+
}
|
|
3057
3060
|
let output = String(content);
|
|
3058
3061
|
for (const s of strip2) {
|
|
3059
3062
|
if (output.endsWith(String(s))) {
|
|
@@ -4468,6 +4471,9 @@ function stripChars(content, ...strip2) {
|
|
|
4468
4471
|
|
|
4469
4472
|
// src/literals/stripLeading.ts
|
|
4470
4473
|
function stripLeading(content, ...strip2) {
|
|
4474
|
+
if (isUndefined(content)) {
|
|
4475
|
+
return void 0;
|
|
4476
|
+
}
|
|
4471
4477
|
let output = String(content);
|
|
4472
4478
|
for (const s of strip2) {
|
|
4473
4479
|
if (output.startsWith(String(s))) {
|