Skip to content

Commit

Permalink
Define createBrandedValue method
Browse files Browse the repository at this point in the history
  • Loading branch information
Pl217 committed Sep 6, 2021
1 parent 1dcbb24 commit aa15deb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/util/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ export type Brand<T, S extends { s: symbol }, Label extends string = ''> = T & {
readonly __brand__: S;
readonly __label__: Label;
};

export const createBrandedValue = <T, B extends Brand<T, any, any>>(v: T): B =>
v as B;

0 comments on commit aa15deb

Please sign in to comment.