diff --git a/packages/serverless-runtime-types/types.d.ts b/packages/serverless-runtime-types/types.d.ts index 92479828..4f9ac6a8 100644 --- a/packages/serverless-runtime-types/types.d.ts +++ b/packages/serverless-runtime-types/types.d.ts @@ -1,6 +1,10 @@ import twilio from 'twilio'; import { ServiceContext } from 'twilio/lib/rest/sync/v1/service'; +export type EnvironmentVariables = { + [key: string]: string | undefined; +}; + export type ResourceMap = { [name: string]: { path: string; @@ -17,3 +21,17 @@ export type Context = { getTwilioClient(): twilio.Twilio; DOMAIN_NAME: string; } & T; + +export type ServerlessCallback = ( + error: null | Error, + payload?: object +) => void; + +export type ServerlessFunctionSignature< + T extends EnvironmentVariables = {}, + U extends {} = {} +> = ( + context: Context, + event: U, + callback: ServerlessCallback +) => void | Promise;