Open ariesshrimp opened 5 years ago
We moved off this in native class model as we just use typescript to define the interface and
class Example extends Component {
layout = hbs`<p>{{this.example}}</p>`
@argument example: string = "this string should be set as the value of this.example"
}
and the glimmer approach is to go through args so we have something like
interface ExampleArgs {
example: string
}
class Example extends Component<ExampleArgs> {
layout = hbs`<p>{{this.example}}</p>`
example: string
get example (): string {
return this.args.example ?? 'this string should be set as the value of this.example'
}
}
BUG REPORT
Summary
getDefaultProps()
breaks the native class model of Ember Components.Expected Behavior
Actual Behavior
Possible Solution
Steps to Reproduce
https://codesandbox.io/embed/54ojpz0rox
Context
I want type checking of props passed to my components in templates. Static type checking is not there yet for ember templates. So it's gotta be run-time. But I don't want to be forced to choose between run-time checks and class syntax
Environment
npm ls <package-name>
)Node
is: v10.15.2npm
is: 6.4.1