Skip to content

Commit

Permalink
docs: apply deno task gen
Browse files Browse the repository at this point in the history
  • Loading branch information
Milly committed Aug 12, 2024
1 parent 993f93f commit ccb2c61
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions is/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ export const is: {
*/
SyncFunction: typeof isSyncFunction;
/**
* Return a type predicate function that returns `true` if the type of `x` is `TupleOf<T>` or `TupleOf<T, R>`.
* Return a type predicate function that returns `true` if the type of `x` is `TupleOf<T>`.
*
* Use {@linkcode isUniformTupleOf} to check if the type of `x` is a tuple of uniform types.
*
Expand All @@ -839,7 +839,7 @@ export const is: {
* }
* ```
*
* With `predRest` to represent rest elements:
* With `predRest` to represent rest elements or forward rest elements:
*
* ```ts
* import { is } from "@core/unknownutil";
Expand All @@ -852,6 +852,30 @@ export const is: {
* if (isMyType(a)) {
* const _: [number, string, boolean, ...number[]] = a;
* }
*
* const isMyTypeForwardRest = is.TupleOf(
* is.ArrayOf(is.Number),
* [is.Number, is.String, is.Boolean],
* );
* if (isMyTypeForwardRest(a)) {
* const _: [...number[], number, string, boolean] = a;
* }
* ```
*
* With `predRest` and `predTrail` to represent middle rest elements:
*
* ```ts
* import { is } from "@core/unknownutil";
*
* const isMyType = is.TupleOf(
* [is.Number, is.String, is.Boolean],
* is.ArrayOf(is.Number),
* [is.Number, is.String, is.Boolean],
* );
* const a: unknown = [0, "a", true, 0, 1, 2, 0, "a", true];
* if (isMyType(a)) {
* const _: [number, string, boolean, ...number[], number, string, boolean] = a;
* }
* ```
*
* Depending on the version of TypeScript and how values are provided, it may be necessary to add `as const` to the array
Expand Down

0 comments on commit ccb2c61

Please sign in to comment.