inferred-types 0.53.2 → 0.53.3
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/inferred-types/dist/index.cjs +2 -2
- package/modules/inferred-types/dist/index.cjs.map +1 -1
- package/modules/inferred-types/dist/index.d.mts +7 -17
- package/modules/inferred-types/dist/index.d.ts +7 -17
- package/modules/inferred-types/dist/index.js +2 -2
- package/modules/inferred-types/dist/index.js.map +1 -1
- package/modules/runtime/dist/index.cjs +2 -2
- package/modules/runtime/dist/index.cjs.map +1 -1
- package/modules/runtime/dist/index.d.mts +7 -17
- package/modules/runtime/dist/index.d.ts +7 -17
- package/modules/runtime/dist/index.js +2 -2
- package/modules/runtime/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -13303,21 +13303,6 @@ type AsNarrowingFn$1<TParams extends Tuple$1 | TypedFunction$1, TReturn = unknow
|
|
|
13303
13303
|
*/
|
|
13304
13304
|
type RemoveFnProps$1<T extends AnyFunction$1> = (...args: AsFnMeta$1<T>["args"]) => AsFnMeta$1<T>["returns"];
|
|
13305
13305
|
|
|
13306
|
-
/**
|
|
13307
|
-
* **ToFn**`<T>`
|
|
13308
|
-
*
|
|
13309
|
-
* Ensures that resultant type is a function, where the mapping is:
|
|
13310
|
-
*
|
|
13311
|
-
* - `AnyFunction` - function signature maintained
|
|
13312
|
-
* - `FnMeta` - is converted to a precise function type
|
|
13313
|
-
* - `never` _or_ `ErrorCondition` - returned "as is"
|
|
13314
|
-
*
|
|
13315
|
-
* All other values will return a function of the form `() => T`
|
|
13316
|
-
*
|
|
13317
|
-
* **Related:** `AsFn`
|
|
13318
|
-
*/
|
|
13319
|
-
type ToFn$1<T> = T extends AnyFunction$1 ? T : T extends FnMeta$1<infer _Args, infer _Returns, infer Props, infer Fn> ? IsNever$1<Props> extends true ? Fn : Fn & Props : () => T;
|
|
13320
|
-
|
|
13321
13306
|
/**
|
|
13322
13307
|
* **TypeGuard**
|
|
13323
13308
|
*
|
|
@@ -17471,9 +17456,14 @@ declare function isFalsy<V extends Narrowable$1>(val: V): val is V & FalsyValue$
|
|
|
17471
17456
|
* **isFnWithDict**(input)
|
|
17472
17457
|
*
|
|
17473
17458
|
* Type guard which checks whether a give variable is a function
|
|
17474
|
-
* which
|
|
17459
|
+
* which contains at least one parameter.
|
|
17460
|
+
*
|
|
17461
|
+
* - if you set the parameter types, it will check that precisely the
|
|
17462
|
+
* correct amount are set
|
|
17475
17463
|
*/
|
|
17476
|
-
declare function isFnWithParams<T>(input: T): input is
|
|
17464
|
+
declare function isFnWithParams<T, P extends readonly SimpleToken$1[]>(input: T, ...params: P): input is T & AsNarrowingFn$1<P["length"] extends 0 ? [any, ...any[]] : {
|
|
17465
|
+
[K in keyof P]: SimpleType$1<P[K]>;
|
|
17466
|
+
}, T extends TypedFunction$1 ? ReturnType<T> : unknown>;
|
|
17477
17467
|
|
|
17478
17468
|
/**
|
|
17479
17469
|
* **isFunction**(value)
|
|
@@ -13303,21 +13303,6 @@ type AsNarrowingFn$1<TParams extends Tuple$1 | TypedFunction$1, TReturn = unknow
|
|
|
13303
13303
|
*/
|
|
13304
13304
|
type RemoveFnProps$1<T extends AnyFunction$1> = (...args: AsFnMeta$1<T>["args"]) => AsFnMeta$1<T>["returns"];
|
|
13305
13305
|
|
|
13306
|
-
/**
|
|
13307
|
-
* **ToFn**`<T>`
|
|
13308
|
-
*
|
|
13309
|
-
* Ensures that resultant type is a function, where the mapping is:
|
|
13310
|
-
*
|
|
13311
|
-
* - `AnyFunction` - function signature maintained
|
|
13312
|
-
* - `FnMeta` - is converted to a precise function type
|
|
13313
|
-
* - `never` _or_ `ErrorCondition` - returned "as is"
|
|
13314
|
-
*
|
|
13315
|
-
* All other values will return a function of the form `() => T`
|
|
13316
|
-
*
|
|
13317
|
-
* **Related:** `AsFn`
|
|
13318
|
-
*/
|
|
13319
|
-
type ToFn$1<T> = T extends AnyFunction$1 ? T : T extends FnMeta$1<infer _Args, infer _Returns, infer Props, infer Fn> ? IsNever$1<Props> extends true ? Fn : Fn & Props : () => T;
|
|
13320
|
-
|
|
13321
13306
|
/**
|
|
13322
13307
|
* **TypeGuard**
|
|
13323
13308
|
*
|
|
@@ -17471,9 +17456,14 @@ declare function isFalsy<V extends Narrowable$1>(val: V): val is V & FalsyValue$
|
|
|
17471
17456
|
* **isFnWithDict**(input)
|
|
17472
17457
|
*
|
|
17473
17458
|
* Type guard which checks whether a give variable is a function
|
|
17474
|
-
* which
|
|
17459
|
+
* which contains at least one parameter.
|
|
17460
|
+
*
|
|
17461
|
+
* - if you set the parameter types, it will check that precisely the
|
|
17462
|
+
* correct amount are set
|
|
17475
17463
|
*/
|
|
17476
|
-
declare function isFnWithParams<T>(input: T): input is
|
|
17464
|
+
declare function isFnWithParams<T, P extends readonly SimpleToken$1[]>(input: T, ...params: P): input is T & AsNarrowingFn$1<P["length"] extends 0 ? [any, ...any[]] : {
|
|
17465
|
+
[K in keyof P]: SimpleType$1<P[K]>;
|
|
17466
|
+
}, T extends TypedFunction$1 ? ReturnType<T> : unknown>;
|
|
17477
17467
|
|
|
17478
17468
|
/**
|
|
17479
17469
|
* **isFunction**(value)
|
|
@@ -5068,8 +5068,8 @@ function isFalse(i) {
|
|
|
5068
5068
|
function isFalsy(val) {
|
|
5069
5069
|
return FALSY_VALUES2.includes(val);
|
|
5070
5070
|
}
|
|
5071
|
-
function isFnWithParams(input) {
|
|
5072
|
-
return typeof input === "function" &&
|
|
5071
|
+
function isFnWithParams(input, ...params) {
|
|
5072
|
+
return params.length === 0 ? typeof input === "function" && input?.length > 0 : typeof input === "function" && input?.length === params.length;
|
|
5073
5073
|
}
|
|
5074
5074
|
function isHexadecimal(val) {
|
|
5075
5075
|
return isString(val) && asChars(val).every((i) => isNumericString(i) || ["a", "b", "c", "d", "e", "f"].includes(i.toLowerCase()));
|