From 999c2314c0d649646a53e7cc440ae3f4aa1a3d61 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Tue, 12 Dec 2023 18:47:06 +0530 Subject: feat: commutativity + identity for multiplication --- src/util.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/util.ts') diff --git a/src/util.ts b/src/util.ts index f6067ae..97e9335 100644 --- a/src/util.ts +++ b/src/util.ts @@ -13,7 +13,8 @@ export type ApplyRewrite> = : O extends string ? O : O extends { a: Op, b: Op, op: string } ? ( ApplyRewrite extends O['a'] - ? Omit & { b: ApplyRewrite } + ? (ApplyRewrite extends O['b'] ? O + : Omit & { b: ApplyRewrite }) : Omit & { a: ApplyRewrite } ) : never; @@ -33,6 +34,7 @@ export type ChainRewrites[], O extends Op> = export type VerifyEquation> = Eq['right'] extends 'true' ? true : false & Eq['right']; +export type assert = T; export type Eq = ([a] extends [b] ? ([b] extends [a] ? true : false & { lhs: a; rhs: b }) : false & { lhs: a; rhs: b }); export type Equation = { op: '=', a: A, b: B }; -- cgit v1.3.1