-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extending PropTypes
with Ember specific types
#6
Comments
Sounds like a good idea, as long as we don't create props validators that aren't value added. For example, is there value added to creating a I also think we should avoid namespacing as much as possible and prefer specific names like @evrowe thoughts? |
@Gowiem Hey Matt, thanks for your feedback and we're stoked you're liking the addon! I like where this discussion has gone so far. I think there's definitely value in making sure there is support for Ember constructs within this library, since React isn't going to have validations available for Ember-specific classes. I generally also agree with @DHedgecock that we don't necessarily need to namespace new proptypes so much as name them adequately; this actually simplifies the implementation somewhat. My suspicion is that If it did turn out that the
I will say that I think the point of |
With the merge of [#8] and the fresh release of 1.4.0, this issue should now be fully addressed. |
Hey @evrowe,
I'm just starting to use the library and I'm really digging it. I like having that explicit contract for a component right in the code.
One thing I have run into is that the prop types that React uses don't have any idea of Ember constructs. For example, Ember uses an
Ember.Object
to represent aPromiseArray
. So when usingPropTypes.array
for a collection ofDS.Model
returned from a route it will fail.I would like to build this into this library and I am hoping to discuss adding Ember specific extensions to the
PropTypes
object. These could live onPropTypes.ember.*
so that the component is explicitly stating 'This is an Ember related prop'.For example, some proposed additions I think would be useful:
PropTypes.ember.array
: Checks if the given component prop is anEmber.Array
viaEmber.isArray
PropTypes.ember.model($MODEL_CLASS)
: Checks if the given component prop is an instance of the givenDS.Model
class.Is this of interest, I'd be happy to put together a PR that takes a crack at the above!
The text was updated successfully, but these errors were encountered: