From d97191d6d26abd84e0728fd2681f413779586a9d Mon Sep 17 00:00:00 2001 From: Som Shekhar Mukherjee Date: Thu, 2 Jan 2025 12:27:54 +0530 Subject: [PATCH] doc: improve code comment --- source/set-required.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/set-required.d.ts b/source/set-required.d.ts index a8f362052..d39e1b3c3 100644 --- a/source/set-required.d.ts +++ b/source/set-required.d.ts @@ -51,7 +51,9 @@ type SetArrayRequired< Counter extends any[] = [], Accumulator extends UnknownArray = [], > = TArray extends unknown // For distributing `TArray` when it's a union - ? keyof TArray & `${number}` extends never // Exit if there are no non-rest elements preceding the rest element (e.g., `[...string[]]` or `[...string[], string]`). + ? keyof TArray & `${number}` extends never + // Exit if `TArray` is empty (e.g., []), or + // `TArray` contains no non-rest elements preceding the rest element (e.g., `[...string[]]` or `[...string[], string]`). ? [...Accumulator, ...TArray] : TArray extends readonly [(infer First)?, ...infer Rest] ? '0' extends OptionalKeysOf // If the first element of `TArray` is optional