microsoft / microsoft/TypeScript

Add readonly modifier to Math.min and Math.max

Open
#62,413 5 comments 0 reactions 0 assignees View on GitHub
Bug Domain: check: Type Inference
Dominant language
Go
Stars
111k
Forks
14.3k
PR merge metrics
PR metrics pending

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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.