1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Consolidate some "maybe-types" and arguments using them

Co-authored-by: Janne Savolainen <janne.savolainen@live.fi>

Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
Iku-turso 2022-10-26 11:49:55 +03:00
parent b93bea359b
commit 244ddf7e64
2 changed files with 5 additions and 3 deletions

View File

@ -9,7 +9,9 @@ export interface Orderable {
readonly orderNumber: number;
}
export const orderByOrderNumber = <T extends Orderable | object>(maybeOrderables: T[]) =>
export type MaybeOrderable = Orderable | object;
export const orderByOrderNumber = <T extends MaybeOrderable>(maybeOrderables: T[]) =>
sortBy(
(orderable) =>
"orderNumber" in orderable

View File

@ -10,9 +10,9 @@ export interface Showable {
readonly isShown: IComputedValue<boolean> | boolean;
}
export type MaybeShowable = Partial<Showable>;
export type MaybeShowable = Showable | object;
export const isShown = (showable: Showable | object) => {
export const isShown = (showable: MaybeShowable) => {
if (!("isShown" in showable)) {
return true;
}