Skip to content
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

Idea: instanceOf(containerKey) #126

Open
dfreeman opened this issue Jun 7, 2017 · 1 comment
Open

Idea: instanceOf(containerKey) #126

dfreeman opened this issue Jun 7, 2017 · 1 comment

Comments

@dfreeman
Copy link

dfreeman commented Jun 7, 2017

I've had this idea in the back of my mind for a while now, and I wanted to run it here to get your thoughts before spending time on a PR. What do you think of augmenting instanceOf to allow it to take a container key?

This would allow something like this:

// ...
import SomeModel from 'my-app/models/some-model';

export default Component.extend({
  propTypes: {
    prop: PropTypes.instanceOf(SomeModel)
  }
});

To become:

// ...

export default Component.extend({
  propTypes: {
    prop: PropTypes.instanceOf('model:some-model')
  }
});

This seems (to me) to align nicely with how most other things in Ember work against the resolver rather than using direct imports. I did a quick pass over the existing implementation and I believe this would be pretty simple to implement—if I opened a PR, would you be interested?

@sglanzer-deprecated
Copy link
Contributor

Yup, definitely interested - I believe @notmessenger was looking for something like this very recently

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants