diff --git a/package-lock.json b/package-lock.json index bfdf316..d6c19fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "json-expression-eval", - "version": "2.0.0", + "version": "2.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1848,6 +1848,11 @@ } } }, + "ts-toolbelt": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/ts-toolbelt/-/ts-toolbelt-3.7.1.tgz", + "integrity": "sha512-rEIk3vYCAEQ1qvCvlYjfgNdAu5BIxRIcDSgJBEDsz5UR1/oKIJz7/I8yE8x1rPqs1o2A4deCuqVvuzdMk5JxiQ==" + }, "tslib": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", diff --git a/package.json b/package.json index a69faa0..66eb958 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "json-expression-eval", - "version": "2.0.1", + "version": "2.0.2", "description": "evaluate a json described boolean expression using dynamic functions", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -47,5 +47,7 @@ "tslint": "^5.18.0", "typescript": "^3.5.3" }, - "dependencies": {} + "dependencies": { + "ts-toolbelt": "^3.7.1" + } } diff --git a/src/index.ts b/src/index.ts index 97cfbdf..662e02c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,7 @@ 'use strict'; +import {O as tObject} from 'ts-toolbelt'; + export type PropertyCompareOp = C[K]; export type FuncCompareOp, K extends keyof F> = Parameters[0]; @@ -52,13 +54,7 @@ export interface NotCompareOp> { not: Expression; } -export type RequireOnlyOne = - Pick> - & { - [K in Keys]-?: - Required> - & Partial, undefined>> -}[Keys]; +export type RequireOnlyOne = tObject.Either; export type Expression> = NotCompareOp | OrCompareOp | AndCompareOp | RequireOnlyOne>;