(options: {
readonly op: string
readonly single?: Single
readonly eval?: (
this: Primitive & { readonly [args]: Single extends true ? Parameters<Fn>[0] : Parameters<Fn> },
fiber: MicroFiberImpl
) => Primitive | Micro<any, any, any> | Yield
readonly contA?: (
this: Primitive & { readonly [args]: Single extends true ? Parameters<Fn>[0] : Parameters<Fn> },
value: any,
fiber: MicroFiberImpl
) => Primitive | Micro<any, any, any> | Yield
readonly contE?: (
this: Primitive & { readonly [args]: Single extends true ? Parameters<Fn>[0] : Parameters<Fn> },
cause: MicroCause<any>,
fiber: MicroFiberImpl
) => Primitive | Micro<any, any, any> | Yield
readonly ensure?: (
this: Primitive & { readonly [args]: Single extends true ? Parameters<Fn>[0] : Parameters<Fn> },
fiber: MicroFiberImpl
) => void | ((value: any, fiber: MicroFiberImpl) => void)
})
| 746 | } as any) |
| 747 | |
| 748 | const makePrimitive = <Fn extends (...args: Array<any>) => any, Single extends boolean = true>(options: { |
| 749 | readonly op: string |
| 750 | readonly single?: Single |
| 751 | readonly eval?: ( |
| 752 | this: Primitive & { readonly [args]: Single extends true ? Parameters<Fn>[0] : Parameters<Fn> }, |
| 753 | fiber: MicroFiberImpl |
| 754 | ) => Primitive | Micro<any, any, any> | Yield |
| 755 | readonly contA?: ( |
| 756 | this: Primitive & { readonly [args]: Single extends true ? Parameters<Fn>[0] : Parameters<Fn> }, |
| 757 | value: any, |
| 758 | fiber: MicroFiberImpl |
| 759 | ) => Primitive | Micro<any, any, any> | Yield |
| 760 | readonly contE?: ( |
| 761 | this: Primitive & { readonly [args]: Single extends true ? Parameters<Fn>[0] : Parameters<Fn> }, |
| 762 | cause: MicroCause<any>, |
| 763 | fiber: MicroFiberImpl |
| 764 | ) => Primitive | Micro<any, any, any> | Yield |
| 765 | readonly ensure?: ( |
| 766 | this: Primitive & { readonly [args]: Single extends true ? Parameters<Fn>[0] : Parameters<Fn> }, |
| 767 | fiber: MicroFiberImpl |
| 768 | ) => void | ((value: any, fiber: MicroFiberImpl) => void) |
| 769 | }): Fn => { |
| 770 | const Proto = makePrimitiveProto(options as any) |
| 771 | return function() { |
| 772 | const self = Object.create(Proto) |
| 773 | self[args] = options.single === false ? arguments : arguments[0] |
| 774 | return self |
| 775 | } as Fn |
| 776 | } |
| 777 | |
| 778 | const makeExit = <Fn extends (...args: Array<any>) => any, Prop extends string>(options: { |
| 779 | readonly op: "Success" | "Failure" |
no test coverage detected