Handle configurations that don't wrap their action sequences in arrays (#8798)

This commit is contained in:
Paulus Schoutsen
2021-04-02 05:45:34 -07:00
committed by GitHub
parent a0b5bc5456
commit 82ad5c103d
6 changed files with 74 additions and 47 deletions

View File

@@ -1,5 +1,7 @@
type NonUndefined<T> = T extends undefined ? never : T;
export function ensureArray(value: undefined): undefined;
export function ensureArray<T>(value: T | T[]): T[];
export function ensureArray<T>(value: T | T[]): NonUndefined<T>[];
export function ensureArray(value) {
if (value === undefined || Array.isArray(value)) {
return value;