Files
tools/core/stdlib/src/functions/compose/index.test-d.ts
T
robonen 96f4cba4a8 feat(stdlib): new modules + eslint/tsconfig migration
- Add array/async/etc. modules and type tests; migrate to eslint flat config
  and composite tsconfig (vitest typecheck enabled).
- Fix PubSub.emit to snapshot listeners before iterating (stable EventEmitter
  semantics; avoids invoking listeners added during the same emit).
2026-06-07 16:29:08 +07:00

19 lines
673 B
TypeScript

import { describe, expectTypeOf, it } from 'vitest';
import { compose } from '.';
describe('compose', () => {
it('infers the final return type through the chain', () => {
const fn = compose((s: string) => s.length > 0, (n: number) => `${n}`, (n: number) => n + 1);
expectTypeOf(fn).parameters.toEqualTypeOf<[number]>();
expectTypeOf(fn).returns.toEqualTypeOf<boolean>();
});
it('keeps the variadic parameters of the last function', () => {
const fn = compose((n: number) => `${n}`, (a: number, b: number) => a + b);
expectTypeOf(fn).parameters.toEqualTypeOf<[number, number]>();
expectTypeOf(fn).returns.toEqualTypeOf<string>();
});
});