Skip to content

Commit ccb2c61

Browse files
committed
docs: apply deno task gen
1 parent 993f93f commit ccb2c61

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

is/mod.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ export const is: {
823823
*/
824824
SyncFunction: typeof isSyncFunction;
825825
/**
826-
* Return a type predicate function that returns `true` if the type of `x` is `TupleOf<T>` or `TupleOf<T, R>`.
826+
* Return a type predicate function that returns `true` if the type of `x` is `TupleOf<T>`.
827827
*
828828
* Use {@linkcode isUniformTupleOf} to check if the type of `x` is a tuple of uniform types.
829829
*
@@ -839,7 +839,7 @@ export const is: {
839839
* }
840840
* ```
841841
*
842-
* With `predRest` to represent rest elements:
842+
* With `predRest` to represent rest elements or forward rest elements:
843843
*
844844
* ```ts
845845
* import { is } from "@core/unknownutil";
@@ -852,6 +852,30 @@ export const is: {
852852
* if (isMyType(a)) {
853853
* const _: [number, string, boolean, ...number[]] = a;
854854
* }
855+
*
856+
* const isMyTypeForwardRest = is.TupleOf(
857+
* is.ArrayOf(is.Number),
858+
* [is.Number, is.String, is.Boolean],
859+
* );
860+
* if (isMyTypeForwardRest(a)) {
861+
* const _: [...number[], number, string, boolean] = a;
862+
* }
863+
* ```
864+
*
865+
* With `predRest` and `predTrail` to represent middle rest elements:
866+
*
867+
* ```ts
868+
* import { is } from "@core/unknownutil";
869+
*
870+
* const isMyType = is.TupleOf(
871+
* [is.Number, is.String, is.Boolean],
872+
* is.ArrayOf(is.Number),
873+
* [is.Number, is.String, is.Boolean],
874+
* );
875+
* const a: unknown = [0, "a", true, 0, 1, 2, 0, "a", true];
876+
* if (isMyType(a)) {
877+
* const _: [number, string, boolean, ...number[], number, string, boolean] = a;
878+
* }
855879
* ```
856880
*
857881
* Depending on the version of TypeScript and how values are provided, it may be necessary to add `as const` to the array

0 commit comments

Comments
 (0)