Ember-types
Sometymes you need types and assertions when organizing bigger application. Addon provides extensions to assert types for computed properties and function parameters in runtime.
_ _
___ _ __ ___ | |__ ___ _ __ | |_ _ _ _ __ ___ ___
/ _ \ '_ ` _ \| '_ \ / _ \ '__|____| __| | | | '_ \ / _ \/ __|
| __/ | | | | | |_) | __/ | |_____| |_| |_| | |_) | __/\__ \
\___|_| |_| |_|_.__/ \___|_| \__|\__, | .__/ \___||___/
|___/|_|
Installation
ember install ember-error-handler
Typed computed property
;Object;
or with passing computed
;const computed = Ember;Object;
or empty
;Object;
Assert type of function arguments
;{;};
Types validators (assertions)
Assertions could be defined as string, Assertion Validator or Class name
Assertion based on shortcuts
;;
supported shortcuts
- array
- boolean
- function
- nothing
- number
- object
- string
Assertion based on class
;;
Assertion based on validator
;;
Assertion based on enumeration
;// will fail;
Custom validators could be implemented
;;;{if typeof value !== 'boolean'throw `value must be boolean`;}name: 'boolean';
See LogicalOr validator as advanced validator implementation
Naming tooling
Extension also includes tooling for proper class / function / instance naming
TBD
Will-be tooling
Extension also includes tooling for definition of non-scalar values on classes
TBD
Function decorators
TBD