Skip to main content
Home

latest

Collection of type utils

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
a year ago (1.0.6)
function array
array<T>(inner: TypeGuard<T>): unknown

Applies a type guard to each element of an array and returns a new array of the specified type.

Type Parameters

  • The type of the elements in the array.

Parameters

inner: TypeGuard<T>
  • The type guard function to apply to each element.

Return Type

unknown
  • An array of type T.

Throws

Error
  • If the input value is not an array.

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@clapp/types

Import symbol

import { array } from "@clapp/types";
or

Import directly with a jsr specifier

import { array } from "jsr:@clapp/types";

Add Package

pnpm i jsr:@clapp/types
or (using pnpm 10.8 or older)
pnpm dlx jsr add @clapp/types

Import symbol

import { array } from "@clapp/types";

Add Package

yarn add jsr:@clapp/types
or (using Yarn 4.8 or older)
yarn dlx jsr add @clapp/types

Import symbol

import { array } from "@clapp/types";

Add Package

vlt install jsr:@clapp/types

Import symbol

import { array } from "@clapp/types";

Add Package

npx jsr add @clapp/types

Import symbol

import { array } from "@clapp/types";

Add Package

bunx jsr add @clapp/types

Import symbol

import { array } from "@clapp/types";