json2typescript
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -1078,3 +1078,3 @@ "use strict"; | ||
// Check if objects match | ||
if ((expectedType instanceof Object || typeof expectedType === "string") && value instanceof Object) { | ||
if (((expectedType instanceof Object && [String, Number, Boolean].includes(expectedType) === false) || typeof expectedType === "string") && value instanceof Object) { | ||
// If the expected type is a string (means: lazy-loading), get the real type from the registered classes | ||
@@ -1124,4 +1124,5 @@ if (typeof expectedType === "string") { | ||
else { | ||
if (this.ignorePrimitiveChecks) | ||
if (this.ignorePrimitiveChecks && ["string", "number", "boolean"].includes(typeof (value))) { | ||
return value; | ||
} | ||
throw new Error("\tReason: Given value type does not match the expected primitive type."); | ||
@@ -1131,7 +1132,2 @@ } | ||
} | ||
console.log("---------2"); | ||
console.log(expectedDimension); | ||
console.log(expectedType); | ||
console.log(valueDimension); | ||
console.log(value); | ||
// All other attempts are fatal | ||
@@ -1138,0 +1134,0 @@ throw new Error("\tReason: Mapping failed because of an unknown error."); |
@@ -1075,3 +1075,3 @@ import { Any } from "./any"; | ||
// Check if objects match | ||
if ((expectedType instanceof Object || typeof expectedType === "string") && value instanceof Object) { | ||
if (((expectedType instanceof Object && [String, Number, Boolean].includes(expectedType) === false) || typeof expectedType === "string") && value instanceof Object) { | ||
// If the expected type is a string (means: lazy-loading), get the real type from the registered classes | ||
@@ -1121,4 +1121,5 @@ if (typeof expectedType === "string") { | ||
else { | ||
if (this.ignorePrimitiveChecks) | ||
if (this.ignorePrimitiveChecks && ["string", "number", "boolean"].includes(typeof (value))) { | ||
return value; | ||
} | ||
throw new Error("\tReason: Given value type does not match the expected primitive type."); | ||
@@ -1128,7 +1129,2 @@ } | ||
} | ||
console.log("---------2"); | ||
console.log(expectedDimension); | ||
console.log(expectedType); | ||
console.log(valueDimension); | ||
console.log(value); | ||
// All other attempts are fatal | ||
@@ -1135,0 +1131,0 @@ throw new Error("\tReason: Mapping failed because of an unknown error."); |
{ | ||
"name": "json2typescript", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "Provides TypeScript methods to map a JSON object to a JavaScript object on runtime", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
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
299230
4369