Skip to content

Commit 5f4fe87

Browse files
committed
fix: add function overloads for reply/send to narrow return types
When react is not provided, return type is now correctly inferred as APIPromise (with asResponse/withResponse methods) instead of the union type APIPromise | Promise.
1 parent 3e6a74b commit 5f4fe87

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/resources/emails.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ export class Emails extends APIResource {
5151
*
5252
* Note: When using the `react` option, this method returns a Promise instead of APIPromise.
5353
*/
54+
reply(
55+
id: string,
56+
body: EmailReplyParams & { react: unknown },
57+
options?: RequestOptions,
58+
): Promise<EmailReplyResponse>;
59+
reply(id: string, body: EmailReplyParams, options?: RequestOptions): APIPromise<EmailReplyResponse>;
5460
reply(
5561
id: string,
5662
body: EmailReplyParams,
@@ -87,6 +93,8 @@ export class Emails extends APIResource {
8793
*
8894
* Note: When using the `react` option, this method returns a Promise instead of APIPromise.
8995
*/
96+
send(body: EmailSendParams & { react: unknown }, options?: RequestOptions): Promise<EmailSendResponse>;
97+
send(body: EmailSendParams, options?: RequestOptions): APIPromise<EmailSendResponse>;
9098
send(
9199
body: EmailSendParams,
92100
options?: RequestOptions,

0 commit comments

Comments
 (0)