Skip to content

Conversation

@jamescdavis
Copy link
Member

Components generated in an addon are not currently functional because they are missing the manual setting of their layout property to their compiled template.

@jamescdavis jamescdavis force-pushed the generate-functioning-addon-components branch from 4ed2470 to 7e19628 Compare March 2, 2018 17:44
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';
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops!

@jamescdavis
Copy link
Member Author

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 @types/ember-glimmer or just make it part of @types/ember?

@jamescdavis jamescdavis force-pushed the generate-functioning-addon-components branch from 7e19628 to 4cec874 Compare March 5, 2018 17:12
@chriskrycho
Copy link
Member

Yeah, it's just not reporting. :sigh:

@chriskrycho chriskrycho merged commit cea46c3 into typed-ember:master Mar 5, 2018
@dfreeman
Copy link
Member

dfreeman commented Mar 5, 2018

@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.

@jamescdavis jamescdavis deleted the generate-functioning-addon-components branch March 5, 2018 19:08
dfreeman pushed a commit that referenced this pull request Aug 21, 2018
…omponents

Generate functioning addon components
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

Successfully merging this pull request may close these issues.

3 participants