@sinclair/typebox 0.33.0 → 0.33.1
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.
|
@@ -7,7 +7,7 @@ const immutable_1 = require("./immutable");
|
|
|
7
7
|
const value_1 = require("../clone/value");
|
|
8
8
|
/** Creates TypeBox schematics using the configured InstanceMode */
|
|
9
9
|
function CreateType(schema, options) {
|
|
10
|
-
const result = options !== undefined ?
|
|
10
|
+
const result = options !== undefined ? { ...options, ...schema } : schema;
|
|
11
11
|
switch (policy_1.TypeSystemPolicy.InstanceMode) {
|
|
12
12
|
case 'freeze':
|
|
13
13
|
return (0, immutable_1.Immutable)(result);
|
|
@@ -60,7 +60,7 @@ function Intrinsic(schema, mode, options = {}) {
|
|
|
60
60
|
// Intrinsic-Mapped-Inference
|
|
61
61
|
(0, kind_1.IsMappedKey)(schema) ? (0, intrinsic_from_mapped_key_1.IntrinsicFromMappedKey)(schema, mode, options) :
|
|
62
62
|
// Standard-Inference
|
|
63
|
-
(0, kind_1.IsTemplateLiteral)(schema) ? FromTemplateLiteral(schema, mode,
|
|
63
|
+
(0, kind_1.IsTemplateLiteral)(schema) ? FromTemplateLiteral(schema, mode, options) :
|
|
64
64
|
(0, kind_1.IsUnion)(schema) ? (0, index_3.Union)(FromRest(schema.anyOf, mode), options) :
|
|
65
65
|
(0, kind_1.IsLiteral)(schema) ? (0, index_2.Literal)(FromLiteralValue(schema.const, mode), options) :
|
|
66
66
|
// Default Type
|
|
@@ -3,7 +3,7 @@ import { Immutable } from './immutable.mjs';
|
|
|
3
3
|
import { Clone } from '../clone/value.mjs';
|
|
4
4
|
/** Creates TypeBox schematics using the configured InstanceMode */
|
|
5
5
|
export function CreateType(schema, options) {
|
|
6
|
-
const result = options !== undefined ?
|
|
6
|
+
const result = options !== undefined ? { ...options, ...schema } : schema;
|
|
7
7
|
switch (TypeSystemPolicy.InstanceMode) {
|
|
8
8
|
case 'freeze':
|
|
9
9
|
return Immutable(result);
|
|
@@ -56,7 +56,7 @@ export function Intrinsic(schema, mode, options = {}) {
|
|
|
56
56
|
// Intrinsic-Mapped-Inference
|
|
57
57
|
IsMappedKey(schema) ? IntrinsicFromMappedKey(schema, mode, options) :
|
|
58
58
|
// Standard-Inference
|
|
59
|
-
IsTemplateLiteral(schema) ? FromTemplateLiteral(schema, mode,
|
|
59
|
+
IsTemplateLiteral(schema) ? FromTemplateLiteral(schema, mode, options) :
|
|
60
60
|
IsUnion(schema) ? Union(FromRest(schema.anyOf, mode), options) :
|
|
61
61
|
IsLiteral(schema) ? Literal(FromLiteralValue(schema.const, mode), options) :
|
|
62
62
|
// Default Type
|