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:
parent
b93bea359b
commit
244ddf7e64
@ -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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user