Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

[@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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants