Improve type inferencing

This commit is contained in:
NightKev 2025-04-27 17:32:48 -07:00
parent cb42cf50dc
commit e3c415bb5a

View File

@ -616,6 +616,7 @@ export function getShinyDescriptor(variant: Variant): string {
* If the input isn't already an array, turns it into one. * 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 * @returns An array with the same type as the type of the input
*/ */
export function coerceArray<T>(input: T | T[]): T[] { export function coerceArray<T>(input: T): T extends any[] ? T : [T];
export function coerceArray<T>(input: T): T | [T] {
return Array.isArray(input) ? input : [input]; return Array.isArray(input) ? input : [input];
} }