@sinclair/typebox 0.34.2 → 0.34.3

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.
@@ -32,6 +32,14 @@ function HasDefaultProperty(schema) {
32
32
  // Types
33
33
  // ------------------------------------------------------------------
34
34
  function FromArray(schema, references, value) {
35
+ // if the value is an array, we attempt to initialize it's elements
36
+ if ((0, index_5.IsArray)(value)) {
37
+ for (let i = 0; i < value.length; i++) {
38
+ value[i] = Visit(schema.items, references, value[i]);
39
+ }
40
+ return value;
41
+ }
42
+ // ... otherwise use default initialization
35
43
  const defaulted = ValueOrDefault(schema, value);
36
44
  if (!(0, index_5.IsArray)(defaulted))
37
45
  return defaulted;
@@ -28,6 +28,14 @@ function HasDefaultProperty(schema) {
28
28
  // Types
29
29
  // ------------------------------------------------------------------
30
30
  function FromArray(schema, references, value) {
31
+ // if the value is an array, we attempt to initialize it's elements
32
+ if (IsArray(value)) {
33
+ for (let i = 0; i < value.length; i++) {
34
+ value[i] = Visit(schema.items, references, value[i]);
35
+ }
36
+ return value;
37
+ }
38
+ // ... otherwise use default initialization
31
39
  const defaulted = ValueOrDefault(schema, value);
32
40
  if (!IsArray(defaulted))
33
41
  return defaulted;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinclair/typebox",
3
- "version": "0.34.2",
3
+ "version": "0.34.3",
4
4
  "description": "Json Schema Type Builder with Static Type Resolution for TypeScript",
5
5
  "keywords": [
6
6
  "typescript",