Skip to content

Commit 234d7a6

Browse files
author
Vapi Tasker
committed
fix: correct SayHookAction exact field type from Record<string, unknown> to string | string[]
1 parent 812250d commit 234d7a6

3 files changed

Lines changed: 36 additions & 1 deletion

File tree

.fernignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22

33
README.md
44
changelog.md
5+
tests/unit/types/SayHookAction.test.ts
6+
7+
# PRO-3057: Manually fixed incorrect type for exact field (was Record<string, unknown>, should be string | string[])
8+
src/api/types/SayHookAction.ts

src/api/types/SayHookAction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ export interface SayHookAction {
99
*/
1010
prompt?: Vapi.SayHookActionPrompt | undefined;
1111
/** This is the message to say */
12-
exact?: Record<string, unknown> | undefined;
12+
exact?: string | string[] | undefined;
1313
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import type { SayHookAction } from "../../../src/api/types/SayHookAction.js";
2+
3+
describe("SayHookAction", () => {
4+
it("should accept a string for exact", () => {
5+
const action: SayHookAction = {
6+
exact: "Hello, how can I help you?",
7+
};
8+
expect(action.exact).toBe("Hello, how can I help you?");
9+
});
10+
11+
it("should accept a string array for exact", () => {
12+
const action: SayHookAction = {
13+
exact: ["Hello!", "How can I help you?"],
14+
};
15+
expect(action.exact).toEqual(["Hello!", "How can I help you?"]);
16+
});
17+
18+
it("should allow exact to be undefined", () => {
19+
const action: SayHookAction = {};
20+
expect(action.exact).toBeUndefined();
21+
});
22+
23+
it("should allow both prompt and exact to be set", () => {
24+
const action: SayHookAction = {
25+
prompt: "Greet the user warmly",
26+
exact: "Welcome!",
27+
};
28+
expect(action.prompt).toBe("Greet the user warmly");
29+
expect(action.exact).toBe("Welcome!");
30+
});
31+
});

0 commit comments

Comments
 (0)