# ts-unimplemented

> Utility function to indicate unimplemented code by throwing with a message of "Not implemented".

Latest version **2.0.0** (published 2022-10-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install ts-unimplemented
pnpm add ts-unimplemented
yarn add ts-unimplemented
bun add ts-unimplemented
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2022-10-29 |
| First published | 2020-04-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | ^12.20.0 \|\| ^14.13.1 \|\| >=16.0.0 |
| Dependencies | 0 |
| Unpacked size | 2.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | linusu |
| Keywords | bottom type, typescript, unimplemented, unreachable |

## Links

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

## 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

- 2.0.0 (latest) — 2022-10-29
- 1.0.0 — 2020-04-20

## README

# Unimplemented for TypeScript

Utility function to indicate unimplemented code by throwing with a message of "Not implemented".

This allows your code to type-check, which is useful if you are implementing an interface that requires multiple methods which you don't plan of using all of.

The difference between `unimplemented` and [`todo`][todo] is that while [`todo`][todo] conveys an intent of implementing the functionality later and the message is "not yet implemented", `unimplemented` makes no such claims. Its message is "not implemented".

[todo]: https://github.com/LinusU/ts-todo

Advantages over simply throwing an error:

- You can easily search your codebase for `unimplemented()`
- The error thrown will have the code `ERR_UNIMPLEMENTED`
- Very clear what intentions it conveys

## Installation

```sh
npm install --save ts-unimplemented
```

## Usage

```typescript
import unimplemented from 'ts-unimplemented'

// Say we have an interface Foo:
interface Foo {
  bar(): number
  baz(): void
  qux(): Promise<number>
}

// We want to implement Foo for 'MyClass', but for some reason it only makes sense to implement the bar() function. baz() and qux() will still need to be defined in our implementation of Foo, but we can use unimplemented in their definitions to allow our code to compile.
//
// We still want to have our program stop running if the unimplemented methods are reached.
class MyClass implements Foo {
  bar () {
    return 1 + 1
  }

  baz () {
    return unimplemented()
  }

  qux () {
    return unimplemented()
  }
}
```

## Related Packages

- [`ts-todo`](https://github.com/LinusU/ts-todo)
- [`ts-unreachable`](https://github.com/LinusU/ts-unreachable)
- [`ts-unwrap`](https://github.com/LinusU/ts-unwrap)

## Prior Art

- Rust [`unimplemented` macro](https://doc.rust-lang.org/std/macro.unimplemented.html)

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