FaasJS
Home
  • Guide
  • Documents
  • Templates
  • Changelog
  • Ecosystem

    • Docker Images
  • Github
  • Contributing
  • Sponsor
  • Security
Home
  • Guide
  • Documents
  • Templates
  • Changelog
  • Ecosystem

    • Docker Images
  • Github
  • Contributing
  • Sponsor
  • Security

Documents / @faasjs/types / InferFaasAction

Type Alias: InferFaasAction<TApi>

InferFaasAction<TApi> = TApi extends object ? object : TApi extends object ? TDefault extends object ? 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's params field.
  • 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 } }

See

  • FaasParams
  • FaasData