microsoft / microsoft/TypeScript
`controller.byobRequest` type incorrectly says value is possibly null while `autoAllocateChunkSize` is present.
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
🔎 Search Terms
autoAllocateChunkSize
🕗 Version & Regression Information
- This is the behaviour in every version I tried, and I reviewed the FAQ for entries about readable, streams, byob, and autoallocatechunksize
⏯ Playground Link
💻 Code
new ReadableStream({
type: "bytes",
autoAllocateChunkSize: 1024,
pull(controller) {
controller.close();
controller.byobRequest.respond(0);
},
});
🙁 Actual behavior
TypeScript says controller.byobRequest can be ReadableStreamBYOBRequest | null and errors when one tries to do .respond on it as null doesn't have that.
🙂 Expected behavior
TypeScript should say controller.byobRequest is ReadableStreamBYOBRequest because the autoAllocateChunkSize property is set. Meaning it can't be null according to https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream#autoallocatechunksize
Additional information about the issue
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提供された TypeScript Playground のリンクから始め、autoAllocateChunkSize と controller.byobRequest に関する ReadableStream コンストラクターの型定義を調べてください。nullability エラーを再現し、次に型定義が設定されたバイトストリームをどのように反映すべきかを判断し、例で nullability エラーなしに .respond(0) を受け入れられることを確認してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100