Comparing version 0.6.0 to 0.6.1
@@ -564,2 +564,5 @@ "use strict"; | ||
} | ||
if (_is_union(node)) { | ||
return _resolve_union_primitive(node); | ||
} | ||
if (_node_type_is_enum(node)) { | ||
@@ -597,2 +600,9 @@ return t.PRIMITIVE.ENUM; | ||
} | ||
function _is_union(node) { | ||
const union_type = _get_first_level_child(node, typescript_1.default.SyntaxKind.UnionType); | ||
if (union_type) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
function _is_intersection(node) { | ||
@@ -720,3 +730,3 @@ const intersection_node = _get_first_level_child(node, typescript_1.default.SyntaxKind.IntersectionType); | ||
} | ||
// Method for solving primitive of interecetion type | ||
// Method for solving primitive of intersecetion type | ||
// Not clean method | ||
@@ -802,2 +812,14 @@ function _resolve_direct_node_primitive(node) { | ||
} | ||
function _resolve_union_primitive(node) { | ||
const union_type = _get_first_level_child(node, typescript_1.default.SyntaxKind.UnionType); | ||
if (!union_type) { | ||
return t.PRIMITIVE.UNRESOLVED; | ||
} | ||
const type_literals = _get_nested_children(union_type, typescript_1.default.SyntaxKind.TypeLiteral); | ||
const type_references = _get_nested_children(union_type, typescript_1.default.SyntaxKind.TypeReference); | ||
if (type_literals.length > 0 || type_references.length > 0) { | ||
return t.PRIMITIVE.UNRESOLVED; | ||
} | ||
return t.PRIMITIVE.ENUM; | ||
} | ||
// Method for solving primitive of interecetion type | ||
@@ -804,0 +826,0 @@ // Not clean method |
{ | ||
"name": "plutonio", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "A typescript library that scans your typescript project and generate a schema of all types and interfaces of the project.", | ||
@@ -13,2 +13,4 @@ "main": "dist/index.js", | ||
"prepare": "yarn husky install .repo/husky && yarn husky set .repo/husky/pre-commit \"yarn precommit\"", | ||
"prepare:run": "mv src/index.ts src/index.ts__ && mv src/index.ts_ src/index.ts", | ||
"remove:run": "mv src/index.ts src/index.ts_ && mv src/index.ts__ src/index.ts", | ||
"test:watch:verbose": "NODE_ENV=dev yarn jest --coverage --watch --verbose=true", | ||
@@ -15,0 +17,0 @@ "test:watch": "NODE_ENV=dev yarn jest --coverage --watch --verbose=false --silent", |
@@ -695,2 +695,5 @@ /** | ||
} | ||
if (_is_union(node)) { | ||
return _resolve_union_primitive(node); | ||
} | ||
if (_node_type_is_enum(node)) { | ||
@@ -729,2 +732,10 @@ return t.PRIMITIVE.ENUM; | ||
function _is_union(node: ts.Node): boolean { | ||
const union_type = _get_first_level_child(node, ts.SyntaxKind.UnionType); | ||
if (union_type) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
function _is_intersection(node: ts.Node): boolean { | ||
@@ -881,3 +892,3 @@ const intersection_node = _get_first_level_child( | ||
// Method for solving primitive of interecetion type | ||
// Method for solving primitive of intersecetion type | ||
// Not clean method | ||
@@ -982,2 +993,21 @@ function _resolve_direct_node_primitive(node: ts.Node): t.Primitive { | ||
function _resolve_union_primitive(node: ts.Node): t.Primitive { | ||
const union_type = _get_first_level_child(node, ts.SyntaxKind.UnionType); | ||
if (!union_type) { | ||
return t.PRIMITIVE.UNRESOLVED; | ||
} | ||
const type_literals = _get_nested_children( | ||
union_type, | ||
ts.SyntaxKind.TypeLiteral | ||
); | ||
const type_references = _get_nested_children( | ||
union_type, | ||
ts.SyntaxKind.TypeReference | ||
); | ||
if (type_literals.length > 0 || type_references.length > 0) { | ||
return t.PRIMITIVE.UNRESOLVED; | ||
} | ||
return t.PRIMITIVE.ENUM; | ||
} | ||
// Method for solving primitive of interecetion type | ||
@@ -984,0 +1014,0 @@ // Not clean method |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
109255
2487