microsoft / microsoft/TypeScript
Add readonly modifier to Math.min and Math.max
还没有人认领这个 Issue。
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 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_
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 lib.es5.d.ts 开始,检查 Math.min 和 Math.max 的声明。根据当前签名验证 readonly number[] 示例,更新定义以使该示例通过类型检查,并确认项目测试仍涵盖 Math 的现有行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 55/100