aboutsummaryrefslogtreecommitdiff
path: root/src/types.ts
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2022-01-13 14:49:05 +0530
committerAkshay Nair <phenax5@gmail.com>2022-01-13 14:49:05 +0530
commit6b9a3d2ee4ec49f38f02106e3aa264946b7cdc93 (patch)
treeb884da940ff47683064e1723655ed46b8ab7f85d /src/types.ts
parent6362218062a7b41e4aefe902ba5aed11aaa540c5 (diff)
downloadelxr-6b9a3d2ee4ec49f38f02106e3aa264946b7cdc93.tar.gz
elxr-6b9a3d2ee4ec49f38f02106e3aa264946b7cdc93.zip
refactor: type + constructors refactor
Diffstat (limited to 'src/types.ts')
-rw-r--r--src/types.ts28
1 files changed, 14 insertions, 14 deletions
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<ExprT>
+}>
-export const Expr = constructors<ExprT>()
+export const Expr = constructors<Expr>()
export type ListExpr = [
Option<Expr>,