type-fest/test-d/arrayable.ts
Max 9aabcb9864
Add Arrayable type #270 (#935)
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
2024-08-12 14:22:57 +02:00

10 lines
450 B
TypeScript

import {expectType} from 'tsd';
import type {Arrayable} from '../index';
declare const unknown: unknown;
expectType<Arrayable<string>>(unknown as string | readonly string[]);
expectType<Arrayable<string | {foo: number}>>(unknown as (string | {foo: number}) | ReadonlyArray<string | {foo: number}>);
expectType<Arrayable<never>>(unknown as /* never | */ readonly never[]);
expectType<Arrayable<string[]>>(unknown as string[] | readonly string[][]);