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

[@glimmer/component] Make component generic over args #182

Merged
merged 1 commit into from
Mar 25, 2019

Conversation

mike-north
Copy link
Contributor

This allows TS consumers to (optionally) benefit from formalizing the interface a component has with the outside world.

import Component from '@glimmer/component';

export default class Foo extends Component<{ word: string}> {

  printWord() {
     console.log(this.args.word); // type-safe access to args
  }
}

Copy link
Contributor

@NullVoxPopuli NullVoxPopuli left a comment

Choose a reason for hiding this comment

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

🙌 🎉

@rwjblue
Copy link
Member

rwjblue commented Mar 25, 2019

Change looks good to me, and mirrors what was done in the types for the "ember consumers"

class GlimmerComponent<T> extends _GlimmerComponent<T> {

@rwjblue rwjblue merged commit a034ac0 into glimmerjs:master Mar 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants