Skip to content

Commit

Permalink
DPO-2282 Move Writable to @digitraffic/common
Browse files Browse the repository at this point in the history
  • Loading branch information
solita-jkhaak committed Dec 8, 2023
1 parent 3f493e8 commit d08db19
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/types/util-types.ts
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
export type ValueOf<Obj> = Obj[keyof Obj];

/**
* Type-level conversion from readonly object to mutable object. Use with caution!
*
* Only converts in the type-level. Caution must be used, as the typescript cannot enforce readonly-ness at
* runtime. This is only useful for type-checking and especially in cases where 3rd party code requires
* mutable even though it is not needed.
*/
export type Writable<T> = { -readonly [P in keyof T]: T[P] };

0 comments on commit d08db19

Please sign in to comment.