arktype 2.0.0-rc.30 → 2.0.0-rc.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeIndex } from "@ark/schema";
|
|
1
|
+
import { intrinsic, normalizeIndex } from "@ark/schema";
|
|
2
2
|
import { append, escapeChar, isArray, isEmptyObject, printable, stringAndSymbolicEntriesOf, throwParseError } from "@ark/util";
|
|
3
3
|
import { invalidDefaultableKeyKindMessage, invalidOptionalKeyKindMessage, parseProperty } from "./property.js";
|
|
4
4
|
export const parseObjectLiteral = (def, ctx) => {
|
|
@@ -15,7 +15,12 @@ export const parseObjectLiteral = (def, ctx) => {
|
|
|
15
15
|
if (!isEmptyObject(structure))
|
|
16
16
|
return throwParseError(nonLeadingSpreadError);
|
|
17
17
|
const operand = ctx.$.parseOwnDefinitionFormat(v, ctx);
|
|
18
|
-
|
|
18
|
+
// treat object domain as empty for spreading (useful for generic constraints)
|
|
19
|
+
if (operand.equals(intrinsic.object))
|
|
20
|
+
continue;
|
|
21
|
+
if (!operand.hasKind("intersection") ||
|
|
22
|
+
// still error on attempts to spread proto nodes like ...Date
|
|
23
|
+
!operand.basis?.equals(intrinsic.object)) {
|
|
19
24
|
return throwParseError(writeInvalidSpreadTypeMessage(operand.expression));
|
|
20
25
|
}
|
|
21
26
|
spread = operand.structure;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arktype",
|
|
3
3
|
"description": "TypeScript's 1:1 validator, optimized from editor to runtime",
|
|
4
|
-
"version": "2.0.0-rc.
|
|
4
|
+
"version": "2.0.0-rc.32",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "David Blass",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"out"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@ark/
|
|
38
|
-
"@ark/
|
|
37
|
+
"@ark/schema": "0.32.0",
|
|
38
|
+
"@ark/util": "0.32.0"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|