microsoft / microsoft/TypeScript

`extends ArrayBufferLike` works for own package; but causes errors for downstream users

オープン
#35,172 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

Needs Proposal Suggestion
主要言語
Go
スター
111k
フォーク
14.4k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

TypeScript Version: 3.5.1

Search Terms:

  • extends ArrayBufferLike
  • TS2312
  • An interface can only extend an object type or intersection of object types with statically known members.

Code

Repro,
https://github.com/AnyhowStep/ts-issue-35172

The line of code that introduced the problem,
https://github.com/AnyhowStep/type-mapping/commit/cb420b8e14dda4de5bf017bcc4a3ab3f35e71de5#diff-f84343d86daf9a112cfa32bdb89c7cdaR2

The following is safe to use on own package and downstream packages,

interface Buffer {
    ___doesNotExist? : any;
}

The following causes downstream packages to break,

interface Buffer extends ArrayBufferLike {
    ___doesNotExist? : any;
}

Expected behavior:

Option A:

  • Should crash for own package
  • Should crash for downstream packages

Option B:

  • Should not crash for own package
  • Should not crash for downstream packages

Actual behavior:

  • Does not crash for own package
  • Crashes for downstream packages

Playground Link:

None.

But I have repro steps,

https://github.com/AnyhowStep/ts-issue-35172

Related Issues:

None that I could find.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

リンクされている AnyhowStep/ts-issue-35172 の再現から始め、issue 内の 2 つの Buffer 宣言を、参照されている type-mapping commit も含めて比較してください。downstream-package の失敗を確認し、compiler がその宣言を一貫して拒否すべきか、一貫して受け入れるべきかを判断してください。選択した挙動を再現し、適切な regression test でカバーできれば完了です。

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

評価

技術スタック
typescript
領域
compilers
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

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

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