# ts-is-defined

> Typescript utilities

Latest version **3.0.5** (published 2023-08-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install ts-is-defined
pnpm add ts-is-defined
yarn add ts-is-defined
bun add ts-is-defined
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.5 |
| Published | 2023-08-15 |
| First published | 2020-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | iyegoroff |
| Maintainers | iyegoroff |
| Keywords | typescript, assert |

## Links

- npm: https://www.npmjs.com/package/ts-is-defined
- Repository: https://github.com/iyegoroff/ts-is-defined
- Homepage: https://github.com/iyegoroff/ts-is-defined#readme
- Issues: https://github.com/iyegoroff/ts-is-defined/issues
- npm.io page: https://npm.io/package/ts-is-defined

## Dependencies (1)

- [ts-tiny-invariant](https://npm.io/package/ts-tiny-invariant.md) ^2.0.5

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 3.0.5 (latest) — 2023-08-15
- 3.0.4 — 2022-05-28
- 3.0.3 — 2022-05-13
- 3.0.2 — 2022-05-12
- 3.0.1 — 2022-05-12
- 2.0.4 — 2022-04-27
- 2.0.3 — 2021-11-08
- 2.0.2 — 2021-11-07
- 2.0.1 — 2021-10-29
- 2.0.0 — 2021-10-29
- 1.0.1 — 2021-07-26
- 1.0.0 — 2020-08-16
- 0.0.3 — 2020-04-25

## README

# ts-is-defined

[![npm](https://img.shields.io/npm/v/ts-is-defined)](https://npm.im/ts-is-defined)
[![build](https://github.com/iyegoroff/ts-is-defined/workflows/build/badge.svg)](https://github.com/iyegoroff/ts-is-defined/actions/workflows/build.yml)
[![publish](https://github.com/iyegoroff/ts-is-defined/workflows/publish/badge.svg)](https://github.com/iyegoroff/ts-is-defined/actions/workflows/publish.yml)
![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/npm/ts-is-defined)
[![Bundlephobia](https://img.shields.io/bundlephobia/minzip/ts-is-defined?label=min+gzip)](https://bundlephobia.com/package/ts-is-defined)
[![npm](https://img.shields.io/npm/l/ts-is-defined.svg?t=1495378566925)](https://www.npmjs.com/package/ts-is-defined)

<!-- [![Bundlephobia](https://badgen.net/bundlephobia/minzip/ts-is-defined?label=min+gzip)](https://bundlephobia.com/package/ts-is-defined) -->

Typescript utilities

```ts
export function isDefined<T>(value: T): value is NonNullable<T> {
  return value !== undefined && value !== null
}

export function assertDefined<T>(
  value: T,
  message: string
): asserts value is NonNullable<T> {
  invariant(isDefined(value), message)
}
```

---
_Source: https://npm.io/package/ts-is-defined · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
