maybe-types
v0.2.0
Published
[![npm version][npm-version-src]][npm-version-href] [![npm downloads][npm-downloads-src]][npm-downloads-href] [![bundle][bundle-src]][bundle-href] [![Codecov][codecov-src]][codecov-href] [![License][license-src]][license-href] [![JSDocs][jsdocs-src]][jsdo
Downloads
126
Readme
maybe-types
A collection of types for Maybe
in TypeScript.
Usage
Install package:
# npm
npm install maybe-types
# yarn
yarn add maybe-types
# pnpm
pnpm install maybe-types
Import:
import type { MaybePromise } from "maybe-types";
const fn = async (arg: string): MaybePromise<string> => {
if (arg === "foo") {
return "bar";
}
return Promise.resolve("baz");
};
const getPromise = async (): Promise<string> => {
return promise = await fn("foo");
};
Development
- Clone this repository
- Install latest LTS version of Node.js
- Enable Corepack using
corepack enable
- Install dependencies using
pnpm install
- Run interactive tests using
pnpm test
License
Made with 💛
Published under MIT License.