From 6b9a3d2ee4ec49f38f02106e3aa264946b7cdc93 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Thu, 13 Jan 2022 14:49:05 +0530 Subject: refactor: type + constructors refactor --- src/types.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/types.ts') diff --git a/src/types.ts b/src/types.ts index 07e6e8a..d30413d 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,27 +1,27 @@ import {Option} from "fp-ts/lib/Option" import { constructors, Union } from "./utils" -type ExprT = { - Start: null, - End: null, +type _ = never + +export type Expr = Union<{ + Start: _, + End: _, Optional: { expr: Expr }, OneOrMore: { expr: Expr }, ZeroOrMore: { expr: Expr }, - NextItem: null, - AnyItem: null, + NextItem: _, + AnyItem: _, Or: { left: Expr, right: Expr[] }, - AnyString: null, - AnyNumber: null, - AnyBool: null, - Truthy: null, - Falsey: null, + AnyString: _, + AnyNumber: _, + AnyBool: _, + Truthy: _, + Falsey: _, Group: { exprs: Expr[] }, PropertyMatch: { name: string, exprs: Expr[] }, -} - -export type Expr = Union +}> -export const Expr = constructors() +export const Expr = constructors() export type ListExpr = [ Option, -- cgit v1.3.1