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.