Pipeable API tests
All checks were successful
Lint / lint (push) Successful in 11s

This commit is contained in:
Julien Valverdé
2025-02-20 00:21:43 +01:00
parent 36d5414d10
commit fffbd01b5e

View File

@@ -384,7 +384,17 @@ export interface ScopeOptions {
} }
export const make = <T extends Array<unknown>>( // export const make = <T extends Array<unknown>>(
...contexts: [...{ [K in keyof T]: ReffuseContext.ReffuseContext<T[K]> }] // ...contexts: [...{ [K in keyof T]: ReffuseContext.ReffuseContext<T[K]> }]
): Reffuse<T[number]> => // ): Reffuse<T[number]> =>
new Reffuse(contexts) // new Reffuse(contexts)
export const make = (): Reffuse<never> => new Reffuse([])
export const withContexts = <R2 extends Array<unknown>>(
...contexts: [...{ [K in keyof R2]: ReffuseContext.ReffuseContext<R2[K]> }]
) =>
<T extends Reffuse<R1>, R1>(self: T & Reffuse<R1>): (
Reffuse<R1 | R2[number]> & Exclude<T, Reffuse<R1>>
) =>
new Reffuse([...self.contexts, ...contexts as any]) as any