mirror of
https://github.com/sindresorhus/type-fest.git
synced 2025-12-08 19:25:05 +00:00
13 lines
382 B
TypeScript
13 lines
382 B
TypeScript
import {expectType} from 'tsd';
|
|
import type {IfUnknown} from '../index';
|
|
|
|
// `IfUnknown` should return `true`/`false` if only `T` is specified
|
|
expectType<IfUnknown<unknown>>(true);
|
|
expectType<IfUnknown<string>>(false);
|
|
expectType<IfUnknown<unknown, 'T', 'F'>>('T');
|
|
expectType<IfUnknown<string, 'T', 'F'>>('F');
|
|
|
|
// Missing generic parameter
|
|
// @ts-expect-error
|
|
type A = IfUnknown;
|