canjs / can-observable-mixin

Define properties on JavaScript classes
https://canjs.com
MIT License
2 stars 1 forks source link

Error message improvment for arrays #141

Closed cherifGsoul closed 5 years ago

cherifGsoul commented 5 years ago

For https://github.com/canjs/canjs/issues/5310

This improves the type error message for arrays:

class Foo extends mixinObject() {
    static get props() {
       return {
         list: []
       };
    }
}

var foo = new Foo();  
foo.list = [ "one", "two" ]; // This will work b/c type is converted to array