From e3c415bb5a9a8fb4eaeb5bb2db683282b22c80b8 Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Sun, 27 Apr 2025 17:32:48 -0700 Subject: [PATCH] Improve type inferencing --- src/utils/common.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/common.ts b/src/utils/common.ts index 83e99be378b..c8b37c4e3fd 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -616,6 +616,7 @@ export function getShinyDescriptor(variant: Variant): string { * If the input isn't already an array, turns it into one. * @returns An array with the same type as the type of the input */ -export function coerceArray(input: T | T[]): T[] { +export function coerceArray(input: T): T extends any[] ? T : [T]; +export function coerceArray(input: T): T | [T] { return Array.isArray(input) ? input : [input]; }