Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: fix typo and indentation
  • Loading branch information
som-sm committed Oct 11, 2025
commit 5aaf11da0151d1b7509095d68b62f26c762009b1
6 changes: 3 additions & 3 deletions source/array-reverse.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ type _ArrayReverse<
Result extends UnknownArray = never,
> =
keyof TArray & `${number}` extends never
// Enters this branch, if `Array_` is empty (e.g., `[]`),
// or `Array_` contains no non-rest elements preceding the rest element (e.g., `[...string[]]` or `[...string[], string]`).
// Enters this branch, if `TArray` is empty (e.g., `[]`),
// or `TArray` contains no non-rest elements preceding the rest element (e.g., `[...string[]]` or `[...string[], string]`).
? TArray extends readonly [...infer Rest, infer Last]
? _ArrayReverse<Rest, BeforeRestAcc, [...AfterRestAcc, Last], Result> // Accumulate elements that are present after the rest element in reverse order.
: Result | [...AfterRestAcc, ...TArray, ...BeforeRestAcc] // Add the rest element between the accumulated elements.
Expand All @@ -76,7 +76,7 @@ type _ArrayReverse<
Rest,
[First | (If<IsExactOptionalPropertyTypesEnabled, never, undefined>), ...BeforeRestAcc], // Add `| undefined` for optional elements, if `exactOptionalPropertyTypes` is disabled.
AfterRestAcc,
Result | BeforeRestAcc
Result | BeforeRestAcc
>,
_ArrayReverse<Rest, [First, ...BeforeRestAcc], AfterRestAcc, Result>>
: never; // Should never happen, since `readonly [(infer First)?, ...infer Rest]` is a top-type for arrays.
Expand Down