ember-decorators / argument

Decorators for Component and Object arguments in Ember
MIT License
30 stars 18 forks source link

Use ember's isArray on arrayOf validator #74

Closed miguelcobain closed 6 years ago

miguelcobain commented 6 years ago

I created this pull request as a way to start a suggestion/question.

So, I needed to validate that a certain argument was an array. However, when I tried to use this with the return value of an ember-data's store.findAll I got an error because that's a DS.RecordArray and not a native array.

Would it make sense to use ember's isArray function to detect arrays to allow a better interoperability with ember arrays?

pzuraq commented 6 years ago

I think it makes sense, given the state of arrays in Ember right now. Alternatively, we could create a new type validator, emberArrayOf. Given this library is meant to be a middleground between standard JS and more thorough solutions (TS) I think it’s ok to be looser here