Skip to content

Commit

Permalink
feat(types): add ServerlessFunctionSignature types
Browse files Browse the repository at this point in the history
  • Loading branch information
dkundel committed Jul 8, 2019
1 parent 749e3f4 commit 3d258ba
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/serverless-runtime-types/types.d.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -17,3 +21,17 @@ export type Context<T = {}> = {
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<T>,
event: U,
callback: ServerlessCallback
) => void | Promise<void>;

0 comments on commit 3d258ba

Please sign in to comment.