type-fest/test-d/iterable-element.ts
Sindre Sorhus e3234d74aa Use import type
Closes #390
2022-04-09 19:04:14 +07:00

19 lines
481 B
TypeScript

import {expectType} from 'tsd';
import type {IterableElement} from '../index';
declare const iterableElement: IterableElement<ReturnType<typeof secretGenerator>>;
expectType<1 | 'two'>(iterableElement);
declare const iterableElementAsync: IterableElement<ReturnType<typeof secretGeneratorAsync>>;
expectType<true | Date>(iterableElementAsync);
function * secretGenerator() {
yield 1;
yield 'two';
}
async function * secretGeneratorAsync() {
yield true;
yield new Date();
}