Skip to content

Commit ba05773

Browse files
authored
fix(typescript): accept empty list of suggested prompts for the assistant class (#2650)
1 parent 150f0bd commit ba05773

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/Assistant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type SetSuggestedPromptsFn = (
4646

4747
interface SetSuggestedPromptsArguments {
4848
/** @description Prompt suggestions that appear when opening assistant thread. */
49-
prompts: [AssistantPrompt, ...AssistantPrompt[]];
49+
prompts: AssistantPrompt[];
5050
/** @description Title for the prompts. */
5151
title?: string;
5252
}

test/types/assistant.test-d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { AssistantThreadsSetSuggestedPromptsResponse } from '@slack/web-api';
12
import { expectError, expectType } from 'tsd';
23
import { type AllAssistantMiddlewareArgs, Assistant } from '../../src/Assistant';
34
import type { AssistantThreadContext } from '../../src/AssistantThreadContextStore';
@@ -33,8 +34,13 @@ expectType<Assistant>(
3334
// threadStarted tests
3435
new Assistant({
3536
userMessage: asyncNoop,
36-
threadStarted: async ({ saveThreadContext }) => {
37+
threadStarted: async ({ saveThreadContext, setSuggestedPrompts }) => {
3738
expectType<void>(await saveThreadContext());
39+
expectType<AssistantThreadsSetSuggestedPromptsResponse>(
40+
await setSuggestedPrompts({
41+
prompts: [],
42+
}),
43+
);
3844
return Promise.resolve();
3945
},
4046
});

0 commit comments

Comments
 (0)