chore: use descriptive type parameter names (#9937)

* chore: use descriptive type parameter names

* refactor: requested changes

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Almeida
2023-11-12 17:21:51 +00:00
committed by GitHub
parent 4ff3ea4a1b
commit 975d5f18ae
34 changed files with 1104 additions and 895 deletions

View File

@@ -1,12 +1,12 @@
/**
* Normalizes data that is a rest parameter or an array into an array with a depth of 1.
*
* @typeParam T - The data that must satisfy {@link RestOrArray}.
* @typeParam ItemType - The data that must satisfy {@link RestOrArray}.
* @param arr - The (possibly variadic) data to normalize
*/
export function normalizeArray<T>(arr: RestOrArray<T>): T[] {
export function normalizeArray<ItemType>(arr: RestOrArray<ItemType>): ItemType[] {
if (Array.isArray(arr[0])) return arr[0];
return arr as T[];
return arr as ItemType[];
}
/**
@@ -16,4 +16,4 @@ export function normalizeArray<T>(arr: RestOrArray<T>): T[] {
* This type is used throughout builders to ensure both an array and variadic arguments
* may be used. It is normalized with {@link normalizeArray}.
*/
export type RestOrArray<T> = T[] | [T[]];
export type RestOrArray<Type> = Type[] | [Type[]];