Skip to main content
Version: 1.x

Type Alias: ExtensionFactory<T>

ExtensionFactory<T> = (context) => T

Factory function that creates extension methods from a context.

Type Parameters​

T​

T extends ExtensionMethods

The shape of the methods object returned by this factory.

Parameters​

context​

ExtensionContext

Returns​

T

Example​

const factory: ExtensionFactory<{
approve(id: string): Promise<void>;
}> = (ctx) => ({
async approve(id: string) {
await ctx.handler.click({ id });
},
});