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]; }