Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.

Commit

Permalink
feat: add TypeOf to schemable.ts
Browse files Browse the repository at this point in the history
Additionally, remove the type cast for Category from
prism.ts
  • Loading branch information
baetheus committed Oct 22, 2020
1 parent 723c876 commit b2599e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion prism.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,5 @@ export const atKey = (key: string) =>

export const Category: TC.Category<Prism<_0, _1>> = {
compose: (ij, jk) => compose(jk)(ij),
id: id as <I, J>() => Prism<I, J>,
id,
};
2 changes: 2 additions & 0 deletions schemable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ export type Schema<A> = {
<T, L extends 4, S, R, E>(S: Schemable<T, L>): $<T, [S, R, E, A]>;
};

export type TypeOf<T> = T extends Schema<infer A> ? A : never;

/***************************************************************************************************
* @section Utilities
**************************************************************************************************/
Expand Down

0 comments on commit b2599e7

Please sign in to comment.