Skip to content

Type error message improvement

Compare
Choose a tag to compare
@cherifGsoul cherifGsoul released this 11 Oct 15:00
· 30 commits to master since this release

This improve the error message bu suggestion to use type.convert for the right type:

class Person extends mixinObject() {
    static get props() {
       return {
         age: type.check(Number)
       };
    }
}
var farah = new Person();
farah.age = '4'; // -> `Uncaught Error: 4 is not of type Number. Property age is using "type: Number". Use "age: type.convert(Number)" to automatically convert values to Numbers when setting the "age" property.`

#140