Skip to content

Commit

Permalink
Changed 31 solution
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpocock committed Jun 22, 2023
1 parent 8bbc3c1 commit 9cf88fc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/04-advanced-props/31-as-const.solution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ const BACKEND_TO_FRONTEND_STATUS_MAP = {
2: "error",
} as const;

type BackendStatus = keyof typeof BACKEND_TO_FRONTEND_STATUS_MAP;
type FrontendStatus = (typeof BACKEND_TO_FRONTEND_STATUS_MAP)[BackendStatus];
type BackendStatusMap = typeof BACKEND_TO_FRONTEND_STATUS_MAP;

type BackendStatus = keyof BackendStatusMap;
type FrontendStatus = BackendStatusMap[BackendStatus];

type test = [
Expect<Equal<BackendStatus, 0 | 1 | 2>>,
Expect<Equal<FrontendStatus, "pending" | "success" | "error">>,
Expect<Equal<FrontendStatus, "pending" | "success" | "error">>
];

0 comments on commit 9cf88fc

Please sign in to comment.