Skip to content

Commit

Permalink
fix: improve branded utility type
Browse files Browse the repository at this point in the history
  • Loading branch information
0xyaco committed Sep 20, 2024
1 parent 0076e2c commit f11a12e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 4 additions & 4 deletions packages/automated-dispute/src/types/prophet.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Caip2ChainId } from "@ebo-agent/blocknumber";
import { Brand, NormalizedAddress } from "@ebo-agent/shared";
import { Branded, NormalizedAddress } from "@ebo-agent/shared";
import { Address, Hex } from "viem";

export type RequestId = Brand<NormalizedAddress, "RequestId">;
export type ResponseId = Brand<NormalizedAddress, "ResponseId">;
export type DisputeId = Brand<NormalizedAddress, "DisputeId">;
export type RequestId = Branded<NormalizedAddress, "RequestId">;
export type ResponseId = Branded<NormalizedAddress, "ResponseId">;
export type DisputeId = Branded<NormalizedAddress, "DisputeId">;

export type RequestStatus = "Active" | "Finalized";

Expand Down
6 changes: 5 additions & 1 deletion packages/shared/src/types/brand.ts
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
export type Brand<K, T> = K & { __brand: T };
declare const __brand: unique symbol;

type Brand<B> = { [__brand]: B };

export type Branded<T, B> = T & Brand<B>;

0 comments on commit f11a12e

Please sign in to comment.