# @emphori/promise

> A strongly typed drop-in replacement for Promises in TypeScript

Latest version **1.5.0** (published 2024-05-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @emphori/promise
pnpm add @emphori/promise
yarn add @emphori/promise
bun add @emphori/promise
```

## Health

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

Positive: esm support; no vulnerabilities; has provenance.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.0 |
| Published | 2024-05-22 |
| First published | 2022-08-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 3 |
| Author | Emphori |
| Maintainers | iainreid948 |
| Keywords | promise, promises, strongly-typed, types, typescript |

## Links

- npm: https://www.npmjs.com/package/@emphori/promise
- Repository: https://github.com/emphori/promise
- Homepage: https://github.com/emphori/promise#readme
- Issues: https://github.com/emphori/promise/issues
- npm.io page: https://npm.io/package/@emphori/promise

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

- 1.5.0 (latest) — 2024-05-22
- 1.4.1 — 2023-11-03
- 1.4.0 — 2023-10-31
- 1.3.0 — 2023-02-03
- 1.2.0 — 2022-11-30
- 1.1.0 — 2022-09-18
- 1.0.0 — 2022-08-18

## README

# Promise

A strongly typed drop-in replacement for Promises in TypeScript.


## Features

* **Type-safe rejections** greatly improve how errors are surfaced, and makes
  handling them an absolute joy.

* **A simplified `.then` type signature** that disallows inline rejection
  handling in favour of explict calls to `.catch` when required.

* **Incrementally adoptable** and backwards compatible with the weakly typed
  Promises shipped with TypeScript.


## Installation

Promise is available from the NPM registry and as a GitHub Package. Whichever
source you prefer to use, the installation should remain the same.

```sh
# Using NPM
npm install @emphori/promise -S

# Or, using Yarn
yarn add @emphori/promise
```


## Examples

```ts
import { Promise } from '@emphori/promise'

// (userId: string) => Promise<User, UserNotFound>
function getUser(userId: string): Promise<User, UserNotFound> {
  return User.getById(userId).then((user) => {
    return user ?? Promise.reject(UserNotFound)
  })
}
```

## Licence

This project is released under the [MIT License][license]. Enjoy responsibly ❤️

[license]: https://github.com/emphori/promise/blob/HEAD/LICENSE

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