-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Hello!
I was wondering if there's any to use PropTypes.shape with an EmberObject?
I know you can use instanceOf to check that a thing is an EmberObject, but I'd also like to still assert against its internal properties as well.
Summary
When I use shape to describe an Ember.Object, I get failed prop types for the individual keys, even though I can verify the keys are correct.
Example
For example, let's say I have an Ember model:
export default DS.Model.extend({
type: DS.attr('string'),
items: DS.attr(),
});I'd like to check that using prop-types, like so:
export default P.shape({
type: P.oneOf([
'conversation',
'route'
]).isRequired,
items: P.oneOf([
P.arrayOf(Message),
P.string
]).isRequired,
});However, when I try to use this type in a component by passing in something like:
{
type: "conversation",
...
}I see the following failed prop-type:
Environment Information
Here's my setup:
- OS: masOS El Capitan
- Ember + Ember CLI Version: Ember 2.15
- Node/NPM Version: Node 7, npm 3
- Browser: Chrome, latest
Metadata
Metadata
Assignees
Labels
No labels
