Skip to content

Commit

Permalink
chore: use dynamic return types
Browse files Browse the repository at this point in the history
  • Loading branch information
svedova committed Apr 17, 2023
1 parent 40ff774 commit 6aefe1a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/serverless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@ export type App = (
context?: NodeContext
) => void;

type HandlerType = "stormkit" | "stormkit:api";

type ReturnTypes = {
stormkit: StormkitHandler;
"stormkit:api": typeof handleApi;
};

export default (
app?: App,
handler: HandlerType = "stormkit"
): ReturnTypes[typeof handler] => {
handler?: keyof ReturnTypes
): ReturnTypes[keyof ReturnTypes] => {
switch (handler) {
case "stormkit:api":
return handleApi;
Expand Down

0 comments on commit 6aefe1a

Please sign in to comment.