Skip to content

Commit

Permalink
test: add more type test of 'tail'
Browse files Browse the repository at this point in the history
  • Loading branch information
jbl428 authored and ppeeou committed Dec 3, 2021
1 parent c3ce08d commit b240390
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/types/Tail.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
type Tail<T extends unknown[]> = T extends [any, ...infer B] ? B : [];
type Tail<T extends unknown[]> = T extends [any, ...infer U] ? U : [];

export default Tail;
2 changes: 2 additions & 0 deletions type-check/types/Tail.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ checks([
check<Tail<[1]>, [], Test.Pass>(),
check<Tail<[1, 2]>, [2], Test.Pass>(),
check<Tail<[1, 2, 3]>, [2, 3], Test.Pass>(),
check<Tail<[1, 2, "abc"]>, [2, "abc"], Test.Pass>(),
check<Tail<[string, number, boolean]>, [number, boolean], Test.Pass>(),
]);

0 comments on commit b240390

Please sign in to comment.