Releases: egeozcan/ppipe
Releases · egeozcan/ppipe
v3.2.0
Added
Arity checking: Functions now receive compile-time errors when passed extra arguments
ppipe(8).pipe(subtract, _, 3, 5, 10) now errors if subtract only takes 2 params
Uses ExactArityFn<Fn, N> helper type to enforce exact parameter count
Variadic functions (rest params) are allowed through the check
Type-level test file (test/types.test.ts) with @ts-expect-error validation
New npm script typecheck:arity for running type-level tests
Changed
Placeholder overloads now use Awaited<T> for contextual typing of lambda parameters
Overloads use ReturnType<Fn> instead of generic R for better type extraction
3.1.0
New Feature: Generic Pass-Through Extensions
Extensions using generic identity functions now preserve the pipe's type correctly.
Previously, extensions like (value: T) => T would cause the type to become unknown, breaking type inference in subsequent pipe calls. This is now fixed.
Example:
const pp = ppipe.extend({
log: (value: T, label?: string): T => {
console.log(label ?? 'value:', value);
return value;
},
});
// Type is preserved through .log()
pp(8)
.log('start') // logs: "start: 8"
.pipe(x => x + 3) // x is number ✓ (was unknown before)
.log('end') // logs: "end: 11"
.value; // 11
This enables type-safe utility extensions like log(), tap(), debug(), and similar pass-through helpers.