Comparing version 1.0.13-alpha to 1.0.14-alpha
@@ -5,6 +5,13 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "writeUnboundableMessage", { | ||
enumerable: true, | ||
get: ()=>writeUnboundableMessage | ||
function _export(target, all) { | ||
for(var name in all)Object.defineProperty(target, name, { | ||
enumerable: true, | ||
get: all[name] | ||
}); | ||
} | ||
_export(exports, { | ||
writeDoubleRightBoundMessage: ()=>writeDoubleRightBoundMessage, | ||
writeUnboundableMessage: ()=>writeUnboundableMessage | ||
}); | ||
const writeDoubleRightBoundMessage = (root)=>`Expression ${root} must have at most one right bound`; | ||
const writeUnboundableMessage = (root)=>`Bounded expression ${root} must be a number, string or array`; |
@@ -27,2 +27,3 @@ "use strict"; | ||
const _genericsJs = require("../utils/generics.js"); | ||
const _numericLiteralsJs = require("../utils/numericLiterals.js"); | ||
const _pathsJs = require("../utils/paths.js"); | ||
@@ -266,2 +267,4 @@ const _problemsJs = require("./problems.js"); | ||
isValid = state.traverseKey(k, props.optional[k]) && isValid; | ||
} else if (props.index && _numericLiteralsJs.wellFormedIntegerMatcher.test(k)) { | ||
isValid = state.traverseKey(k, props.index) && isValid; | ||
} else if (kind === "distilledProps") { | ||
@@ -268,0 +271,0 @@ if (state.failFast) { |
@@ -0,1 +1,2 @@ | ||
export const writeDoubleRightBoundMessage = (root)=>`Expression ${root} must have at most one right bound`; | ||
export const writeUnboundableMessage = (root)=>`Bounded expression ${root} must be a number, string or array`; |
@@ -63,2 +63,3 @@ function _checkPrivateRedeclaration(obj, privateCollection) { | ||
import { hasKey, objectKeysOf } from "../utils/generics.js"; | ||
import { wellFormedIntegerMatcher } from "../utils/numericLiterals.js"; | ||
import { getPath, Path } from "../utils/paths.js"; | ||
@@ -249,2 +250,4 @@ import { domainsToDescriptions, objectKindsToDescriptions, Problem, Problems } from "./problems.js"; | ||
isValid = state.traverseKey(k, props.optional[k]) && isValid; | ||
} else if (props.index && wellFormedIntegerMatcher.test(k)) { | ||
isValid = state.traverseKey(k, props.index) && isValid; | ||
} else if (kind === "distilledProps") { | ||
@@ -251,0 +254,0 @@ if (state.failFast) { |
import type { SizedData } from "../../utils/data.js"; | ||
import type { error, isAny } from "../../utils/generics.js"; | ||
import type { NumberLiteral } from "../../utils/numericLiterals.js"; | ||
import type { Scanner } from "../string/shift/scanner.js"; | ||
import type { inferAst, validateAst } from "./ast.js"; | ||
@@ -20,3 +21,5 @@ import type { astToString } from "./utils.js"; | ||
*/ | ||
export type validateBound<l, r, $> = l extends NumberLiteral ? validateAst<r, $> : isBoundable<inferAst<l, $>> extends true ? validateAst<l, $> : error<writeUnboundableMessage<astToString<l>>>; | ||
export type validateBound<l, r, $> = l extends NumberLiteral ? validateAst<r, $> : l extends [infer leftAst, Scanner.Comparator, unknown] ? error<writeDoubleRightBoundMessage<astToString<leftAst>>> : isBoundable<inferAst<l, $>> extends true ? validateAst<l, $> : error<writeUnboundableMessage<astToString<l>>>; | ||
export declare const writeDoubleRightBoundMessage: <root extends string>(root: root) => `Expression ${root} must have at most one right bound`; | ||
type writeDoubleRightBoundMessage<root extends string> = `Expression ${root} must have at most one right bound`; | ||
type isBoundable<data> = isAny<data> extends true ? false : [data] extends [SizedData] ? true : false; | ||
@@ -23,0 +26,0 @@ export declare const writeUnboundableMessage: <root extends string>(root: root) => `Bounded expression ${root} must be a number, string or array`; |
{ | ||
"name": "arktype", | ||
"description": "TypeScript's 1:1 validator, optimized from editor to runtime", | ||
"version": "1.0.13-alpha", | ||
"version": "1.0.14-alpha", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "David Blass", |
@@ -207,4 +207,4 @@ <h1 align="center">ArkType <sub><sup>TypeScript's 1:1 validator</sup></sub></h1> | ||
[<img height="64px" src="https://avatars.githubusercontent.com/u/6759464">](https://github.com/tmm) | ||
[tmm](https://github.com/tmm) | ||
| [tmm](https://github.com/tmm) | [xrexy](https://github.com/xrexy) | | ||
| ------------------------------------------------------------------------- | :------------------------------------------------------------------------: | | ||
| <img height="64px" src="https://avatars.githubusercontent.com/u/6759464"> | <img height="64px" src="https://avatars.githubusercontent.com/u/71969236"> | |
Sorry, the diff of this file is not supported yet
491854
10696