diff --git a/src/pipeline.ts b/src/pipeline.ts index 3c5d1dc..9d379a4 100644 --- a/src/pipeline.ts +++ b/src/pipeline.ts @@ -6,15 +6,12 @@ type PolicyTuple = [policy: Policy, opts?: Opts]; /** Helper type for proper type inference of PolicyTuples in the pipeline. */ // https://stackoverflow.com/a/75806165 // https://stackoverflow.com/a/54608401 -type PolicyTuplesRest = { +type PolicySpread = { [K in keyof T]: PolicyTuple | Policy; }; /** Processes messages through multiple policies, bailing early on rejection. */ -async function pipeline

( - msg: InputMessage, - policies: [...PolicyTuplesRest

], -): Promise { +async function pipeline(msg: InputMessage, policies: [...PolicySpread]): Promise { for (const item of policies) { const [policy, opts] = toTuple(item); const result = await policy(msg, opts);