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
List.Drop<L, N>'s documentation says it removes N entries out of L. However, when way is set to '<-', it retains only the first N entries and drops everything else.
Reproduce the bug
import{L}from"ts-toolbelt";typeFoo=[0,1,2,3,4,5];typeDropFirst2=L.Drop<Foo,2>;// DropFirst2: [2, 3, 4, 5]typeDropLast2=L.Drop<Foo,2,'<-'>;// DropLast2: [0, 1]// example workaround:typeReallyDropLast2=L.Reverse<L.Drop<L.Reverse<Foo>,2>>;// ReallyDropLast2: [0, 1, 2, 3]// or with pure TS:typeAlsoDropLast2=Fooextends[...infer Start,unknown,unknown] ? Start : Foo;
Expected behavior
Expected DropLast2 to have the type [0, 1, 2, 3].
In other words, List.Drop<L, N, '<-'> should only drop the last N entries and retain the rest, mirroring what it does with the default way = '->'.
Possible Solution
Not sure if this is intentional and just a misunderstanding from me :) If so, the docs should make it explicit!
Additional context
Version 9.6.0
The text was updated successfully, but these errors were encountered:
馃悶 Bug Report
Describe the bug
List.Drop<L, N>
's documentation says it removesN
entries out ofL
. However, whenway
is set to'<-'
, it retains only the first N entries and drops everything else.Reproduce the bug
Expected behavior
Expected
DropLast2
to have the type[0, 1, 2, 3]
.In other words,
List.Drop<L, N, '<-'>
should only drop the last N entries and retain the rest, mirroring what it does with the defaultway = '->'
.Possible Solution
Not sure if this is intentional and just a misunderstanding from me :) If so, the docs should make it explicit!
Additional context
Version 9.6.0
The text was updated successfully, but these errors were encountered: