Documents / @faasjs/types / InferFaasAction
Type Alias: InferFaasAction<TApi>
InferFaasAction<
TApi> =TApiextendsobject?object:TApiextendsobject?TDefaultextendsobject?object:never:never
Infer { Params, Data } from a FaasJS API object or a module whose default
export is a FaasJS API object.
Peers into the exported handler signature to extract:
Params— resolved from the handler event'sparamsfield.Data— resolved from the handler's return type.
Supports direct API objects and module objects with an ESM default export.
Returns never when inference fails.
Type Parameters
TApi
TApi
A Func, Func-like object, or module shape with a
default export.
Returns
An object type with Params and Data properties
when inference succeeds, otherwise never.
Example
import type { InferFaasAction } from '@faasjs/types'
import type * as loginApi from './user/login.api'
type LoginAction = InferFaasAction<typeof loginApi>
// → { Params: { email: string }; Data: { token: string } }