millsp / ts-toolbelt

👷 TypeScript's largest type utility library
https://millsp.github.io/ts-toolbelt/
Apache License 2.0
6.75k stars 148 forks source link

:lady_beetle: `List.Pop<L>` not working with single entry arrays #279

Open rubenaeg opened 2 years ago

rubenaeg commented 2 years ago

🐞 Bug Report

Describe the bug

When using List.Pop<L> with only one entry in the list, the resulting type is an empty list instead of the single element.

Reproduce the bug

// This throws a compiler error
const invalid: List.Pop<['key']> = ['key'];

// This works
const valid: List.Pop<['key']> = [];

Expected behavior

I would expect the type to behave similar to Array.pop(), and it's description lets one assume that it does, but the above example showcases that this is not the case.

Possible Solution

I'm currently testing out a solution for this, as soon as I have more insight I will update the issue.

Screenshots

Additional context

wushuang5112 commented 2 years ago

这是来自QQ邮箱的假期自动回复邮件。   您好,双喜已收到您的邮件,期待与您再次联系!