@zcomponent/core 1.9.0-beta → 1.9.0

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.
package/lib/types.d.ts CHANGED
@@ -29,7 +29,8 @@ export interface BooleanPrimitiveType extends BaseType {
29
29
  }
30
30
  export interface LiteralType extends BaseType {
31
31
  name: 'literal';
32
- value: string | number | boolean | undefined | null;
32
+ value?: string | number | boolean | null;
33
+ isUndefined?: boolean;
33
34
  }
34
35
  export interface ArrayType extends BaseType {
35
36
  name: 'array';
package/lib/types.js CHANGED
@@ -220,6 +220,7 @@ export function mergeTypes(a, b) {
220
220
  name: a.name,
221
221
  typeHint,
222
222
  value: a.value,
223
+ isUndefined: a.isUndefined,
223
224
  comments: mergeComments(a.comments ?? [], b.comments ?? []),
224
225
  };
225
226
  case 'array': {
@@ -323,6 +324,8 @@ export function isValidValueForType(def, t, allowUndefined) {
323
324
  return false;
324
325
  }
325
326
  case 'literal':
327
+ if (def === undefined && t.isUndefined)
328
+ return true;
326
329
  return def === t.value;
327
330
  case 'function':
328
331
  return false;
@@ -352,7 +355,7 @@ function getBasicType(t) {
352
355
  case 'entity':
353
356
  return t.name;
354
357
  case 'literal': {
355
- if (t.value === undefined)
358
+ if (t.isUndefined || t.value === undefined)
356
359
  return 'undefined';
357
360
  return JSON.stringify(t.value);
358
361
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zcomponent/core",
3
- "version": "1.9.0-beta",
3
+ "version": "1.9.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",