A collection of types for Maybe
in TypeScript.
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");
};
- 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
Made with 💛
Published under MIT License.