1
0
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:
Iku-turso 2022-10-25 12:59:24 +03:00
parent 635356517e
commit 16aefcd040
4 changed files with 4 additions and 4 deletions

View File

@ -4,7 +4,7 @@
*/
// 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.
// See: https://www.typescriptlang.org/docs/handbook/2/narrowing.html#exhaustiveness-checking

View File

@ -3,5 +3,5 @@
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
export interface Labelable {
label: string;
readonly label: string;
}

View File

@ -6,7 +6,7 @@
import { sortBy } from "lodash/fp";
export interface Orderable {
orderNumber: number;
readonly orderNumber: number;
}
export const orderByOrderNumber = <T extends Orderable | {}>(maybeOrderables: T[]) =>

View File

@ -7,7 +7,7 @@ import type { IComputedValue } from "mobx";
import { isBoolean } from "../../type-narrowing";
export interface Showable {
isShown: IComputedValue<boolean> | boolean;
readonly isShown: IComputedValue<boolean> | boolean;
}
export type MaybeShowable = Partial<Showable>;