File: index.test-d.ts

package info (click to toggle)
node-p-is-promise 3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 124 kB
  • sloc: makefile: 2
file content (11 lines) | stat: -rw-r--r-- 263 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
import {expectType} from 'tsd';
import isPromise = require('.');

expectType<boolean>(isPromise('🦄'));

const unicorn: unknown = Promise.resolve('🦄');

if (isPromise(unicorn)) {
	expectType<Promise<unknown>>(unicorn);
	expectType<unknown>(await unicorn);
}