broadcasts.update rejects a single replyTo address (type is string[] only)

オープン 初心者向け
#1,206 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
88/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
api

調査の方向性

範囲の狭い型は src/broadcasts/interfaces/update-broadcast.interface.ts にあり、そこで replyTo は string[] として宣言されています。create-broadcast のオプションインターフェースと比較してください。そちらはすでに string | string[] を使っています。update 側の型を合わせて変更し、そのあと TypeScript の型チェックを実行して、単一の文字列が受け入れられることを確認してください。broadcasts.update に 1 つのアドレスを渡しても型チェックが通り、既存の配列形式も引き続き動作すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Describe the Bug

resend.broadcasts.update() only accepts replyTo as string[], so passing a single address fails to typecheck:

await resend.broadcasts.update(id, { replyTo: '[email protected]' });
// Type 'string' is not assignable to type 'string[]'

broadcasts.create() (and emails/templates) type replyTo as string | string[], and the API docs describe reply_to the same way for creating and updating a broadcast. The SDK already sends the value through unchanged, so it's only the type in UpdateBroadcastOptions that's narrower.

Link to the code that reproduces this issue

https://github.com/resend/resend-node/blob/main/src/broadcasts/interfaces/update-broadcast.interface.ts (replyTo?: string[];), compared with src/broadcasts/interfaces/create-broadcast-options.interface.ts (replyTo?: string | string[];)

To Reproduce
  1. In a TypeScript project, call resend.broadcasts.update('<id>', { replyTo: '[email protected]' }).
  2. Run tsc.
Expected Behavior

A single address is accepted on update, the same as on create: replyTo?: string | string[].

What's your node version? (if relevant)

Not relevant (type-only).

主要言語
TypeScript
スター
986
フォーク
101
平均マージ
2日 2時間
マージ済み PR(30日)
26

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

resend/resend-node のほかの issue

resend/resend-node の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。