inferred-types 0.53.11 → 0.53.12

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.
@@ -624,6 +624,13 @@ interface Thenable {
624
624
  }
625
625
 
626
626
  type TupleRange = [required: number, optional: number];
627
+ type _Tuple<TType = unknown, TLength extends number | TupleRange | `${number}+` = 0> = 0 extends TLength ? TType extends any[] ? Readonly<TType> : readonly TType[] : TLength extends number ? Readonly<FixedLengthArray<TType, TLength>> : TLength extends TupleRange ? Readonly<[
628
+ ...FixedLengthArray<TType, TLength[0]>,
629
+ ...FixedLengthArray<TType | undefined, TLength[1]>
630
+ ]> : TLength extends `${infer Num extends number}+` ? Num extends number ? Readonly<[
631
+ ...FixedLengthArray<TType, Num>,
632
+ ...TType[]
633
+ ]> : never : never;
627
634
  /**
628
635
  * **Tuple**`<TType,TLength>`
629
636
  *
@@ -639,13 +646,7 @@ type TupleRange = [required: number, optional: number];
639
646
  * type T2 = Tuple<string, 4>;
640
647
  * ```
641
648
  */
642
- type Tuple<TType = unknown, TLength extends number | TupleRange | `${number}+` = 0> = 0 extends TLength ? TType extends any[] ? Readonly<TType> : readonly TType[] : TLength extends number ? Readonly<FixedLengthArray<TType, TLength>> : TLength extends TupleRange ? Readonly<[
643
- ...FixedLengthArray<TType, TLength[0]>,
644
- ...FixedLengthArray<TType | undefined, TLength[1]>
645
- ]> : TLength extends `${infer Num extends number}+` ? Num extends number ? Readonly<[
646
- ...FixedLengthArray<TType, Num>,
647
- ...TType[]
648
- ]> : never : never;
649
+ type Tuple<TType = unknown, TLength extends number | TupleRange | `${number}+` = 0> = _Tuple<TType, TLength> extends readonly unknown[] ? _Tuple<TType, TLength> : never;
649
650
 
650
651
  type Process$1x<TVal, TDefault> = TVal extends Something ? TVal : TDefault;
651
652
  /**
@@ -13381,8 +13382,10 @@ declare function isArray(value: unknown): value is unknown[];
13381
13382
  * **isBoolean**(value)
13382
13383
  *
13383
13384
  * Type guard which validates that type is a boolean value.
13385
+ *
13386
+ * **Related:** `isBooleanLike()`
13384
13387
  */
13385
- declare function isBoolean<T>(value: T): value is T & boolean;
13388
+ declare function isBoolean(value: unknown): value is boolean;
13386
13389
 
13387
13390
  /**
13388
13391
  * **isBooleanLike**`(val)`
@@ -13456,17 +13459,20 @@ declare function isFalse(i: unknown): i is false;
13456
13459
  declare function isFalsy<V extends Narrowable>(val: V): val is V & FalsyValue;
13457
13460
 
13458
13461
  /**
13459
- * **isFnWithDict**(input)
13462
+ * **isFnWithParams**(input, [...params | count])
13460
13463
  *
13461
13464
  * Type guard which checks whether a give variable is a function
13462
13465
  * which contains at least one parameter.
13463
13466
  *
13464
- * - if you set the parameter types, it will check that precisely the
13465
- * correct amount are set
13467
+ * - the optional second parameter may be used to express the **types** of
13468
+ * the expected parameters or just the expected **count** of parameters
13469
+ * - if you set the parameter types, it will check that the
13470
+ * correct amount of parameters are set but can only _assume_ the types of
13471
+ * the parameters are as you have expressed
13466
13472
  */
13467
- declare function isFnWithParams<T, P extends readonly SimpleToken[]>(input: T, ...params: P): input is T & AsNarrowingFn<P["length"] extends 0 ? [any, ...any[]] : {
13473
+ declare function isFnWithParams<T, P extends (readonly SimpleToken[]) | [number]>(input: T, ...params: P): input is T & AsNarrowingFn<"length" extends keyof T ? T["length"] extends 0 ? IsLiteral<P["length"]> extends true ? Tuple<any, P["length"]> : [any, ...any[]] : [any, ...any[]] : P extends readonly SimpleToken[] ? {
13468
13474
  [K in keyof P]: SimpleType<P[K]>;
13469
- }, T extends TypedFunction ? ReturnType<T> : unknown>;
13475
+ } : P extends [number] ? Tuple<any, P[0]> : never, T extends TypedFunction ? ReturnType<T> : unknown>;
13470
13476
 
13471
13477
  /**
13472
13478
  * **isFunction**(value)
@@ -13475,7 +13481,7 @@ declare function isFnWithParams<T, P extends readonly SimpleToken[]>(input: T, .
13475
13481
  *
13476
13482
  * **Related:** `isFnWithParams`, `ifFunction`
13477
13483
  */
13478
- declare function isFunction<T>(value: T): value is T & TypedFunction;
13484
+ declare function isFunction(value: unknown): value is TypedFunction;
13479
13485
 
13480
13486
  /**
13481
13487
  * **isHexadecimal**`(val)`