Skip to content

Commit

Permalink
Fix #1488 Incorrect types with ViewUpdateResponseAction and ViewPushR…
Browse files Browse the repository at this point in the history
…esponseAction (#1490)
  • Loading branch information
seratch authored Jun 17, 2022
1 parent 3076285 commit 62930f3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
20 changes: 20 additions & 0 deletions src/App-routes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,26 @@ describe('App event routing', () => {
assertMiddlewaresNotCalled();
});
});

describe('Quick type compatibility checks', () => {
it('app.view ack() method can compile with minimum inputs', async () => {
const MockApp = await importApp(buildOverrides([withNoopWebClient()]));
const app = new MockApp({ receiver: fakeReceiver, authorize: sinon.fake.resolves(dummyAuthorizationResult) });
app.view('callback_id', async ({ ack }) => {
await ack({
response_action: 'push',
view: {
type: 'modal',
title: {
type: 'plain_text',
text: 'Title',
},
blocks: [],
},
});
});
});
});
});

/* Testing Harness */
Expand Down
10 changes: 5 additions & 5 deletions src/types/view/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Block, KnownBlock, PlainTextElement } from '@slack/types';
import { Block, KnownBlock, PlainTextElement, View } from '@slack/types';
import { AckFn, RespondFn } from '../utilities';

/**
Expand Down Expand Up @@ -62,7 +62,7 @@ export interface ViewSubmitAction {
id: string;
name: string;
};
response_urls: ViewResponseUrl[];
response_urls?: ViewResponseUrl[];
}

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

export interface ViewWorkflowStepSubmitAction extends ViewSubmitAction {
trigger_id: string;
response_urls: ViewResponseUrl[];
response_urls?: ViewResponseUrl[];
workflow_step: {
workflow_step_edit_id: string;
workflow_id: string;
Expand Down Expand Up @@ -174,12 +174,12 @@ export interface ViewOutput {

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

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

export interface ViewClearResponseAction {
Expand Down

0 comments on commit 62930f3

Please sign in to comment.