Sha256: 537aff717746703d2157ec563b5de4f6393ce9f69a84ae62b49e9b6c80b6e587

Contents?: true

Size: 775 Bytes

Versions: 110

Compression:

Stored size: 775 Bytes

Contents

/**
Create a type that represents either the value or the value wrapped in `PromiseLike`.

Use-cases:
- A function accepts a callback that may either return a value synchronously or may return a promised value.
- This type could be the return type of `Promise#then()`, `Promise#catch()`, and `Promise#finally()` callbacks.

Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/31394) if you want to have this type as a built-in in TypeScript.

@example
```
import {Promisable} from 'type-fest';

async function logger(getLogEntry: () => Promisable<string>): Promise<void> {
    const entry = await getLogEntry();
    console.log(entry);
}

logger(() => 'foo');
logger(() => Promise.resolve('bar'));
```
*/
export type Promisable<T> = T | PromiseLike<T>;

Version data entries

110 entries across 85 versions & 5 rubygems

Version Path
trusty-cms-6.3.1 node_modules/type-fest/source/promisable.d.ts
trusty-cms-6.3.1 node_modules/read-pkg-up/node_modules/type-fest/source/promisable.d.ts
trusty-cms-6.3.1 node_modules/read-pkg/node_modules/type-fest/source/promisable.d.ts
clapton-0.0.26 lib/clapton/javascripts/node_modules/ansi-escapes/node_modules/type-fest/source/promisable.d.ts
clapton-0.0.25 lib/clapton/javascripts/node_modules/ansi-escapes/node_modules/type-fest/source/promisable.d.ts
clapton-0.0.24 lib/clapton/javascripts/node_modules/ansi-escapes/node_modules/type-fest/source/promisable.d.ts
clapton-0.0.23 lib/clapton/javascripts/node_modules/ansi-escapes/node_modules/type-fest/source/promisable.d.ts
clapton-0.0.22 lib/clapton/javascripts/node_modules/ansi-escapes/node_modules/type-fest/source/promisable.d.ts
clapton-0.0.21 lib/clapton/javascripts/node_modules/ansi-escapes/node_modules/type-fest/source/promisable.d.ts
clapton-0.0.20 lib/clapton/javascripts/node_modules/ansi-escapes/node_modules/type-fest/source/promisable.d.ts
clapton-0.0.19 lib/clapton/javascripts/node_modules/ansi-escapes/node_modules/type-fest/source/promisable.d.ts
clapton-0.0.18 lib/clapton/javascripts/node_modules/ansi-escapes/node_modules/type-fest/source/promisable.d.ts
clapton-0.0.17 lib/clapton/javascripts/node_modules/ansi-escapes/node_modules/type-fest/source/promisable.d.ts
clapton-0.0.16 lib/clapton/javascripts/node_modules/ansi-escapes/node_modules/type-fest/source/promisable.d.ts
clapton-0.0.15 lib/clapton/javascripts/node_modules/ansi-escapes/node_modules/type-fest/source/promisable.d.ts
clapton-0.0.14 lib/clapton/javascripts/node_modules/ansi-escapes/node_modules/type-fest/source/promisable.d.ts
clapton-0.0.13 lib/clapton/javascripts/node_modules/ansi-escapes/node_modules/type-fest/source/promisable.d.ts
clapton-0.0.12 lib/clapton/javascripts/node_modules/ansi-escapes/node_modules/type-fest/source/promisable.d.ts
clapton-0.0.11 lib/clapton/javascripts/node_modules/ansi-escapes/node_modules/type-fest/source/promisable.d.ts
clapton-0.0.10 lib/clapton/javascripts/node_modules/ansi-escapes/node_modules/type-fest/source/promisable.d.ts