chore: update

This commit is contained in:
BluJ
2023-03-27 15:38:25 -06:00
parent 42951b4fa2
commit 2607f05e63
5 changed files with 759 additions and 10 deletions

18
lib/test/output.test.ts Normal file
View File

@@ -0,0 +1,18 @@
import { InputSpec, matchInputSpec } from "./output";
type TEqual<A, B> = A extends B ? (B extends A ? null : never) : never;
function testOutput<A, B>(): (c: TEqual<A, B>) => null {
return () => null;
}
const testValue = null as unknown;
// @ts-expect-error Because enable should be a boolean
testOutput<InputSpec["rpc"]["enable"], string>()(null);
testOutput<InputSpec["rpc"]["enable"], boolean>()(null);
testOutput<InputSpec["rpc"]["username"], string>()(null);
// testOutput<InputSpec["rpc"]["advanced"]["auth"], string[]>()(null);
describe("Inputs", () => {
test("test", () => {
expect(true).toEqual(true);
});
});

View File

@@ -166,13 +166,13 @@ export function matchNumberWithRange(range: string) {
leftValue === "*"
? (_) => true
: left === "["
? (x) => x >= Number(leftValue)
: (x) => x > Number(leftValue),
? (x) => x >= Number(leftValue)
: (x) => x > Number(leftValue),
leftValue === "*"
? "any"
: left === "["
? `greaterThanOrEqualTo${leftValue}`
: `greaterThan${leftValue}`
? `greaterThanOrEqualTo${leftValue}`
: `greaterThan${leftValue}`
)
.validate(
// prettier-ignore