microsoft / microsoft/TypeScript

Add readonly modifier to Math.min and Math.max

オープン
#62,413 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る
Bug Domain: check: Type Inference
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

### ⚙ Compilation target

ES2023

### ⚙ Library

lib.es5.d.ts

### Missing / Incorrect Definition

Current signatures of `Math.max` and `Math.min`
```
max(...values: number[]): number;
min(...values: number[]): number;
```
should actually be
```
max(...values: readonly number[]): number;
min(...values: readonly number[]): number;
```
since they do not modify the rest parameter

### Sample Code

```TypeScript
const numbers: readonly number[] = [1, 2, 3, 4, 5];
const min = Math.min.apply(undefined, numbers);
```

### Documentation Link

_No response_

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

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

調査の方向性

lib.es5.d.ts から始めて、Math.min と Math.max の宣言を確認してください。現在のシグネチャに対して readonly number[] のサンプルを検証し、サンプルが型チェックを通るように定義を更新して、既存の Math の動作がプロジェクトのテストで引き続きカバーされていることを確認してください。

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

評価

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

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

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