microsoft / microsoft/TypeScript

`NoInfer` changes behavior for type matching on spread

Đang mở
#63,627 5 bình luận 0 reaction 1 người được giao Được @ahejlsberg nhận Xem trên GitHub
Needs Investigation
Ngôn ngữ chính
Go
Star
111k
Fork
14.3k
Merge trung bình
2 ngày 4 giờ
Pull request đã merge (30 ngày)
132

Mô tả

### 🔎 Search Terms

NoInfer spread

### 🕗 Version & Regression Information

- This is the behavior in every version I tried, and I reviewed the FAQ for entries about `NoInfer`

### ⏯ Playground Link

https://www.typescriptlang.org/play/?ts=6.0.3#code/GYVwdgxgLglg9mABAQwE6oIwApkC5EDaYIAtgEYCmqANIgHQMBycAkmMFQDwEC6AfDwCUiAN4BfAFBpMWAhiEBuCRNCRYCFOgBMOfEVKUa9BryGjJ0nXMXLV0eElXY8iLAA98xclVoM6cfGY2DlRufmEAXj5EADc4GAATYXEVcGw3RCjzQSVUtQdEVR0Xd08DH2N-PTMsuMTkySL3TOjxHIkgA

### 💻 Code

```ts
function arr1(a: [number, ...NoInfer<[]>]) {}
arr1([1]);

function arr2(a: [number, ...[]]) {}
arr2([1]);

function fun1(a: (x: number, ...o: NoInfer<[]>) => void) {}
fun1(x => {});

function fun2(a: (x: number, ...o: []) => void) {}
fun2(x => {});
```

### 🙁 Actual behavior

The two function calls to functions with `NoInfer` triggers type error, while the other two to equivalent function without `NoInfer` don't.

### 🙂 Expected behavior

This code should work without type error.

### Additional information about the issue

_No response_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.