mirror of
https://github.com/sct/overseerr.git
synced 2025-12-28 08:55:28 +01:00
* chore(deps): update all non-major dependencies * fix: correct breaking changes Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: sct <ryan@sct.dev>
21 lines
656 B
TypeScript
21 lines
656 B
TypeScript
export type Undefinable<T> = T | undefined;
|
|
export type Nullable<T> = T | null;
|
|
export type Maybe<T> = T | null | undefined;
|
|
|
|
/**
|
|
* Helps type objects with an arbitrary number of properties that are
|
|
* usually being defined at export.
|
|
*
|
|
* @param component Main object you want to apply properties to
|
|
* @param properties Object of properties you want to type on the main component
|
|
*/
|
|
export function withProperties<A extends object, B extends object>(
|
|
component: A,
|
|
properties: B
|
|
): A & B {
|
|
(Object.keys(properties) as (keyof B)[]).forEach((key) => {
|
|
Object.assign(component, { [key]: properties[key] });
|
|
});
|
|
return component as A & B;
|
|
}
|