microsoft / microsoft/TypeScript
Add readonly modifier to Math.min and Math.max
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
### ⚙ 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_
Contributor guide
Research direction
Start in lib.es5.d.ts and inspect the declarations for Math.min and Math.max. Verify the readonly number[] sample against the current signatures, update the definitions so the sample type-checks, and confirm that existing Math behavior remains covered by the project's tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100