Skip to content

Use generics for triggers #388

@timtucker-dte

Description

@timtucker-dte

For Typescript applications that process inputs that with types that are application-specific but consistent, it would make it easier if interfaces for Azure Functions were built with generics.

As an example, defining the types for service bus topics like this:

export type ServiceBusQueueHandler<T = unknown> = (messages: T, context: InvocationContext) => FunctionResult;

export interface ServiceBusQueueFunctionOptions<T = unknown> extends ServiceBusQueueTriggerOptions, Partial<FunctionOptions> {
    handler: ServiceBusQueueHandler<T>;
    trigger?: ServiceBusQueueTrigger;
}

to reflect the type of object that the handler is working with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions