mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-01 05:52:17 +02:00
Improve type inferencing
This commit is contained in:
parent
cb42cf50dc
commit
e3c415bb5a
@ -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];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user