feat: allow builders to accept rest params and arrays (#7874)

Co-authored-by: Parbez <imranbarbhuiya.fsd@gmail.com>
Co-authored-by: Khafra <42794878+KhafraDev@users.noreply.github.com>
This commit is contained in:
Rodry
2022-06-05 22:29:16 +01:00
committed by GitHub
parent 70c733bb9a
commit ad75be9a9c
13 changed files with 139 additions and 43 deletions

View File

@@ -0,0 +1,6 @@
export function normalizeArray<T>(arr: RestOrArray<T>): T[] {
if (Array.isArray(arr[0])) return arr[0];
return arr as T[];
}
export type RestOrArray<T> = T[] | [T[]];