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

@@ -2,13 +2,13 @@
* Represents a structure that can be checked against another
* given structure for equality
*
* @typeParam T - The type of object to compare the current object to
* @typeParam Value - The type of object to compare the current object to
*/
export interface Equatable<T> {
export interface Equatable<Value> {
/**
* Whether or not this is equal to another structure
*/
equals(other: T): boolean;
equals(other: Value): boolean;
}
/**

View File

@@ -1,13 +1,13 @@
/**
* Represents an object capable of representing itself as a JSON object
*
* @typeParam T - The JSON type corresponding to {@link JSONEncodable.toJSON} outputs.
* @typeParam Value - The JSON type corresponding to {@link JSONEncodable.toJSON} outputs.
*/
export interface JSONEncodable<T> {
export interface JSONEncodable<Value> {
/**
* Transforms this object to its JSON format
*/
toJSON(): T;
toJSON(): Value;
}
/**

View File

@@ -4,15 +4,15 @@
* be needed at all.
*
* @param cb - The callback to lazily evaluate
* @typeParam T - The type of the value
* @typeParam Value - The type of the value
* @example
* ```ts
* const value = lazy(() => computeExpensiveValue());
* ```
*/
// eslint-disable-next-line promise/prefer-await-to-callbacks
export function lazy<T>(cb: () => T): () => T {
let defaultValue: T;
export function lazy<Value>(cb: () => Value): () => Value {
let defaultValue: Value;
// eslint-disable-next-line promise/prefer-await-to-callbacks
return () => (defaultValue ??= cb());
}

View File

@@ -1,4 +1,4 @@
/**
* Represents a type that may or may not be a promise
*/
export type Awaitable<T> = PromiseLike<T> | T;
export type Awaitable<Value> = PromiseLike<Value> | Value;