typescript-is
Advanced tools
Comparing version 0.12.2 to 0.12.3
@@ -8,3 +8,13 @@ "use strict"; | ||
function checkIsClass(type, visitorContext) { | ||
if ((ts.ObjectFlags.Class & type.objectFlags) !== 0) { | ||
// Hacky: using internal TypeScript API. | ||
if ('isArrayType' in visitorContext.checker && visitorContext.checker.isArrayType(type)) { | ||
return false; | ||
} | ||
let hasConstructSignatures = false; | ||
if (type.symbol !== undefined && type.symbol.valueDeclaration !== undefined && ts.isVariableDeclaration(type.symbol.valueDeclaration) && type.symbol.valueDeclaration.type) { | ||
const variableDeclarationType = visitorContext.checker.getTypeAtLocation(type.symbol.valueDeclaration.type); | ||
const constructSignatures = variableDeclarationType.getConstructSignatures(); | ||
hasConstructSignatures = constructSignatures.length >= 1; | ||
} | ||
if ((ts.ObjectFlags.Class & type.objectFlags) !== 0 || hasConstructSignatures) { | ||
if (visitorContext.options.ignoreClasses) { | ||
@@ -11,0 +21,0 @@ return true; |
{ | ||
"name": "typescript-is", | ||
"version": "0.12.2", | ||
"version": "0.12.3", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=6.14.4" |
@@ -282,4 +282,4 @@ # typescript-is | ||
Done as of version `0.10.0`. | ||
* Support detailed error message when using the decorators `@ValidateClass` and `@AssertType`. | ||
* Detect additional keys. [issue 11](https://github.com/woutervh-/typescript-is/issues/11) | ||
* ~~Support detailed error message when using the decorators `@ValidateClass` and `@AssertType`.~~ | ||
* ~~Detect additional keys. [issue 11](https://github.com/woutervh-/typescript-is/issues/11)~~ Done as of version `0.11.0`. | ||
* Promise support. Something like `assertOrReject<Type>(object)` will either `resolve(object)` or `reject(error)`. | ||
@@ -286,0 +286,0 @@ * Optimize the generated conditions. Things like `false || "key" === "key"` can be simplified. Might be more interesting to publish a different library that can transform a TypeScript AST, and then use it here, or use an existing one. Might be out of scope, as there are plenty of minifiers/uglifiers/manglers out there already. |
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
210683
2551