-
Notifications
You must be signed in to change notification settings - Fork 98
Generate functioning addon components #159
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
Generate functioning addon components #159
Conversation
4ed2470 to
7e19628
Compare
blueprints/component/index.js
Outdated
| importTemplate = 'import layout from \'' + templatePath + '\';\n'; | ||
| contents = '\n layout'; | ||
| importTemplate = '// @ts-ignore: Ignore import of compiled template\nimport layout from \'' + templatePath + '\';\n'; | ||
| contents = '\n layout = layout'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] Can we add a semicolon after = layout, since the blueprints tend not to rely on ASI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops!
|
Should I try to get generation of a type declaration working? I'm not sure we have the types yet that we would need to do this. I'm pretty sure it should be this, but I don't think that is published anywhere? Should I open a DefinitelyTyped PR to add it? Would it be appropriate to add a |
7e19628 to
4cec874
Compare
|
Yeah, it's just not reporting. :sigh: |
|
@jamescdavis I don't think I can get back far enough in the Slack history for that link 🙂 As far as I know, the exact contents of compiled templates aren't public API, so if we did expose a type for them, I'd be in favor of just making it an interface with a brand field. I do think generating declarations is an interesting idea. I'd love to have a chat at some point about how we can make generation work nicely throughout the ecosystem—things like ember-css-modules and ember-apollo-client (and I'm sure other addons) would likely benefit from having either something to plug into or an easy example to follow for producing declarations for their own generated modules. |
…omponents Generate functioning addon components
Components generated in an addon are not currently functional because they are missing the manual setting of their layout property to their compiled template.