Skip to main content
Home

latest
Works with
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 Score100%
Downloads28/wk
Publisheda year ago (1.0.1)

Sometimes TypeScript requires the use of loose types.

loose-types

Sometimes TypeScript requires the use of loose types.

npx jsr add @evex/loose-types
bunx --bun add @evex/loose-types
deno add @evex/loose-types

Usage

import { LooseType, LooseArray, LooseFunction, LooseObject, LoosePrimitive } from "@evex/loose-types";

value = getAnyValue() as LooseType;

const getAnyValues = () => {
    ...
    return result as LooseArray;
};

const anyFunction = getAnyValues()[0] as LooseFunction;
const anyObject = getAnyValues()[1] as LooseObject;

const anyObjectWithMustObject = getAnyValues()[1] as LooseObject<{
    foo: string;
}>;

const anyPrimitive = getAnyValues()[2] as LoosePrimitive;

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:@evex/loose-types

Import symbol

import * as loose_types from "@evex/loose-types";
or

Import directly with a jsr specifier

import * as loose_types from "jsr:@evex/loose-types";

Add Package

pnpm i jsr:@evex/loose-types
or (using pnpm 10.8 or older)
pnpm dlx jsr add @evex/loose-types

Import symbol

import * as loose_types from "@evex/loose-types";

Add Package

yarn add jsr:@evex/loose-types
or (using Yarn 4.8 or older)
yarn dlx jsr add @evex/loose-types

Import symbol

import * as loose_types from "@evex/loose-types";

Add Package

vlt install jsr:@evex/loose-types

Import symbol

import * as loose_types from "@evex/loose-types";

Add Package

npx jsr add @evex/loose-types

Import symbol

import * as loose_types from "@evex/loose-types";

Add Package

bunx jsr add @evex/loose-types

Import symbol

import * as loose_types from "@evex/loose-types";