tcomb-decorators
ES7 Decorators for tcomb.
Installation
npm install tcomb-decorators --save
Usage
@func
;; @ { return value + 'World'; } const instance = ; instance; // Worksinstance; // Throws error
@struct
Experimental: The current behaviour maybe changed in the future.
;; @ { thisname = name; } 'John Doe' // Works; // Throws error
The struct
decorator works by wrapping the constructor and using tcomb-validation
s validate
function after class construction. So typ checking is only applyed on initialtion. Further modifications of the object does not lead to an validation again.
LISENCE
MIT