Skip to content

Commit

Permalink
Fix #1454 Missing type declarations in view objects (#1455)
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch authored May 20, 2022
1 parent b9e2043 commit 6928244
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/types/view/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { View, PlainTextElement } from '@slack/types';
import { StringIndexed } from '../helpers';
import { Block, KnownBlock, PlainTextElement } from '@slack/types';
import { AckFn, RespondFn } from '../utilities';

/**
Expand Down Expand Up @@ -28,6 +27,13 @@ interface PlainTextElementOutput {
emoji?: boolean;
}

export interface ViewResponseUrl {
block_id: string;
action_id: string;
channel_id: string;
response_url: string;
}

/**
* A Slack view_submission event wrapped in the standard metadata.
*
Expand Down Expand Up @@ -56,6 +62,7 @@ export interface ViewSubmitAction {
id: string;
name: string;
};
response_urls: ViewResponseUrl[];
}

/**
Expand Down Expand Up @@ -96,7 +103,7 @@ export interface ViewClosedAction {

export interface ViewWorkflowStepSubmitAction extends ViewSubmitAction {
trigger_id: string;
response_urls: [];
response_urls: ViewResponseUrl[];
workflow_step: {
workflow_step_edit_id: string;
workflow_id: string;
Expand Down Expand Up @@ -146,7 +153,7 @@ export interface ViewOutput {
bot_id: string;
title: PlainTextElementOutput;
type: string;
blocks: StringIndexed; // TODO: should this just be any?
blocks: (KnownBlock | Block)[];
close: PlainTextElementOutput | null;
submit: PlainTextElementOutput | null;
state: {
Expand All @@ -167,12 +174,12 @@ export interface ViewOutput {

export interface ViewUpdateResponseAction {
response_action: 'update';
view: View;
view: ViewOutput;
}

export interface ViewPushResponseAction {
response_action: 'push';
view: View;
view: ViewOutput;
}

export interface ViewClearResponseAction {
Expand Down

0 comments on commit 6928244

Please sign in to comment.