A poor man's throw expression
npm install yeet-tsthrow expressions. Until then, yeet!typescript
function save(filename = yeet("Argument required")) { ... }const encoder = encoding === "utf8" ? new UTF8Encoder()
: encoding === "utf16le" ? new UTF16Encoder(false)
: encoding === "utf16be" ? new UTF16Encoder(true)
: yeet(TypeError, "Unsupported encoding");
class Product {
get id() { return this._id; }
set id(value) { this._id = value ?? yeet("Invalid value"); }
}
`Install
$3
`bash
npm install yeet-ts
or
pnpm install yeet-ts
or
bun install yeet-ts
`
... and then
`typescript
import { yeet } from "yeet-ts";
`$3
`typescript
import { yeet } from "https://deno.land/x/yeet@v1.0.3/src/mod.ts";
`
Contribute
To install dependencies:
`bash
bun install
`To build:
`bash
bun run build
`To publish:
`bash
bun run pub
``