From 0f632452d51522cd33a4992af7d9341b300209ca Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Thu, 19 Sep 2024 15:08:12 -0700 Subject: [PATCH] simplify an options type, TODOs --- src/types/options/index.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/types/options/index.ts b/src/types/options/index.ts index eefe54f84..ab6442684 100644 --- a/src/types/options/index.ts +++ b/src/types/options/index.ts @@ -13,18 +13,20 @@ export interface SlackOptionsMiddlewareArgs; } +export type SlackOptions = BlockSuggestion | InteractiveMessageSuggestion | DialogSuggestion; + +// TODO: why call this 'source'? shouldn't it be Type, since it is just the type value? /** * All sources from which Slack sends options requests. */ -export type OptionsSource = 'interactive_message' | 'dialog_suggestion' | 'block_suggestion'; - -export type SlackOptions = BlockSuggestion | InteractiveMessageSuggestion | DialogSuggestion; +export type OptionsSource = SlackOptions['type']; export interface BasicOptionsPayload { type: Type; value: string; } +// TODO: Is this useful? Events have something similar export type OptionsPayloadFromType = KnownOptionsPayloadFromType extends never ? BasicOptionsPayload : KnownOptionsPayloadFromType; @@ -145,8 +147,8 @@ export interface DialogSuggestion extends StringIndexed { type OptionsAckFn = Source extends 'block_suggestion' ? AckFn>> : Source extends 'interactive_message' - ? AckFn>> - : AckFn>>; + ? AckFn>> + : AckFn>>; // TODO: why are the next two interfaces identical? export interface BlockOptions {