Skip to content

Commit bcc6e38

Browse files
authored
Make component constructor arguments explicit
With classic components, it was my understanding that the arguments to `init` / the constructor were private API and that is why they were to be opaquely passed thru using `...arguments`. However, the public API for [glimmer components](https://api.emberjs.com/ember/release/modules/@glimmer%2Fcomponent) specifies that it takes exactly 2: `owner` and `args`, so it seems like it would be better to make this explicit. This also helps avoid errors/warnings when using TypeScript.
1 parent 69579fe commit bcc6e38

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

code/constructors/octane.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import Component from '@glimmer/component';
22

33
export default class SomeComponent extends Component {
4-
constructor() {
5-
super(...arguments);
4+
constructor(owner, args) {
5+
super(owner, args);
66
this.answer = 42;
77
}
88
}

0 commit comments

Comments
 (0)