Improve Forge resolver type exports

The @forge/resolver package only exports the Resolver type:

export default class Resolver {
    private functions;
    define(functionKey: string, cb: ResolverFunction): this;
    private getFunction;
    private sanitizeObject;
    getDefinitions(): DefinitionsHandler;

Because of this, we keep redeclaring the following utility types in each new Forge project:

import Resolver from '@forge/resolver';

export type ResolverFunction = Parameters<Resolver['define']>[1];
export type Request = Parameters<ResolverFunction>[0];
export type Context = Request['context'];
export type Response = ReturnType<ResolverFunction>;

Would it be possible to improve the @forge/resolver type exports to export these types as well?

Hi @tbinna, we can add this as a task to our backlog.

1 Like