You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When Start is 0 and no End is provided the output should be identical to the input, but for a union of tuples this doesn't work when they are of different lengths:
typeX=ArraySlice<['a']|['b','c'],0>;// ^? type X = ['a' | 'b'];
This doesn't repro when Start is not provided or provided as never:
typeX=ArraySlice<['a']|['b','c']>;// ^? type X = ['a'] | ['b', 'c'];typeY=ArraySlice<['a']|['b','c'],never>;// ^? type Y = ['a'] | ['b', 'c'];
A problem in type-fest's ArraySlice causes the issue
(sindresorhus/type-fest#982) but could be
avoided in most cases by avoiding using ArraySlice when not needed.
This is a patch, and the problem would still exist when the optional
limit param is used, but for the vast majority of usages of this
utility, it should be enough to reduce the surface area of the issue,
giving time for the issue to be resolved on the type-fest side.
Closes: #921
Bug description
When Start is 0 and no End is provided the output should be identical to the input, but for a union of tuples this doesn't work when they are of different lengths:
This doesn't repro when Start is not provided or provided as
never
:Repro
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBDAnmApnA3nAglKBDRAZQBtgBjNAXzgDMoIQ4AiJVAWhpQGcYmBuALAAoYazQANAIxwAvNlwES5FAB4A2gHI8GgLpwAPnE0AjDQBo4GsrosAGAHyChAemdx3APQD8w0cgkATLLy+ESkFOpaugZGGqYWVrqOwq7ucN6+QmJw4gDMwTihShGa2nqGJuaW1joWAHYoAG4oUMkubp4+It1AA
Upvote & Fund
The text was updated successfully, but these errors were encountered: