ts-interface-checker
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -117,5 +117,6 @@ /** | ||
export declare function opt(typeSpec: TypeSpec): TOptional; | ||
export declare class TOptional { | ||
export declare class TOptional extends TType { | ||
ttype: TType; | ||
constructor(ttype: TType); | ||
getChecker(suite: ITypeSuite, strict: boolean): CheckerFunc; | ||
} | ||
@@ -122,0 +123,0 @@ /** |
@@ -349,8 +349,17 @@ "use strict"; | ||
exports.opt = opt; | ||
var TOptional = /** @class */ (function () { | ||
var TOptional = /** @class */ (function (_super) { | ||
__extends(TOptional, _super); | ||
function TOptional(ttype) { | ||
this.ttype = ttype; | ||
var _this = _super.call(this) || this; | ||
_this.ttype = ttype; | ||
return _this; | ||
} | ||
TOptional.prototype.getChecker = function (suite, strict) { | ||
var itemChecker = this.ttype.getChecker(suite, strict); | ||
return function (value, ctx) { | ||
return value === undefined || itemChecker(value, ctx); | ||
}; | ||
}; | ||
return TOptional; | ||
}()); | ||
}(TType)); | ||
exports.TOptional = TOptional; | ||
@@ -357,0 +366,0 @@ /** |
{ | ||
"name": "ts-interface-checker", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Runtime library to validate data against TypeScript interfaces", | ||
@@ -47,3 +47,3 @@ "main": "dist/index", | ||
"@types/benchmark": "^1.0.31", | ||
"@types/chai": "^4.0.8", | ||
"@types/chai": "~4.0.8", | ||
"@types/mocha": "^2.2.44", | ||
@@ -50,0 +50,0 @@ "@types/node": "^8.0.57", |
58953
1168