Which package(s) does this problem pertain to?
The following code for helpers worked fine so far:
import Helper from '@ember/component/helper';
export default class MyHelper extends Helper {
compute([name]: [string]) {
return name;
}
}
Now throws a type error, as there is no signature defined. I guess that means I have to duplicate the type declaration in the signature for the compute method now? It is a bit unfortunate that it cannot be inferred, as for example with something like this:
type PropName = 'prop1' | 'prop2';
interface HelperSignature {
PositionalArgs: [obj: MyModel, propName: PropName];
}
export default class MyHelper extends Helper<HelperSignature> {
compute([obj, propName]: [MyModel, PropName]) {
// do something
}
}
It becomes somewhat cumbersome to type this twice. Am I missing something here, or is this the only way to type a helper class like this going forward?
Which package(s) does this problem pertain to?
The following code for helpers worked fine so far:
Now throws a type error, as there is no signature defined. I guess that means I have to duplicate the type declaration in the signature for the
computemethod now? It is a bit unfortunate that it cannot be inferred, as for example with something like this:It becomes somewhat cumbersome to type this twice. Am I missing something here, or is this the only way to type a helper class like this going forward?