mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Make composable responsibilities readonly to nudge towards immutability
Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com>
This commit is contained in:
parent
635356517e
commit
16aefcd040
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// See: https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions
|
// See: https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions
|
||||||
export interface Discriminable<T extends string> { kind: T }
|
export interface Discriminable<T extends string> { readonly kind: T }
|
||||||
|
|
||||||
// Note: this will fail at transpilation time, if all kinds are not instructed in switch/case.
|
// Note: this will fail at transpilation time, if all kinds are not instructed in switch/case.
|
||||||
// See: https://www.typescriptlang.org/docs/handbook/2/narrowing.html#exhaustiveness-checking
|
// See: https://www.typescriptlang.org/docs/handbook/2/narrowing.html#exhaustiveness-checking
|
||||||
|
|||||||
@ -3,5 +3,5 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
export interface Labelable {
|
export interface Labelable {
|
||||||
label: string;
|
readonly label: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
import { sortBy } from "lodash/fp";
|
import { sortBy } from "lodash/fp";
|
||||||
|
|
||||||
export interface Orderable {
|
export interface Orderable {
|
||||||
orderNumber: number;
|
readonly orderNumber: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const orderByOrderNumber = <T extends Orderable | {}>(maybeOrderables: T[]) =>
|
export const orderByOrderNumber = <T extends Orderable | {}>(maybeOrderables: T[]) =>
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import type { IComputedValue } from "mobx";
|
|||||||
import { isBoolean } from "../../type-narrowing";
|
import { isBoolean } from "../../type-narrowing";
|
||||||
|
|
||||||
export interface Showable {
|
export interface Showable {
|
||||||
isShown: IComputedValue<boolean> | boolean;
|
readonly isShown: IComputedValue<boolean> | boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MaybeShowable = Partial<Showable>;
|
export type MaybeShowable = Partial<Showable>;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user