Like components, helpers and modifiers can also have their behavior in templates described by a Signature type.
Helpers
A helper signature has two keys: Args and Return. The Args key is further broken down into Named and Positional elements, representing respectively the expected types of the named and positional arguments your helper expects to receive.
import { helper } from'@ember/component/helper';constadd=helper((values:Array<number>, named: { andThenMultiplyBy?:number }) => {let total =values.reduce((sum, next) => sum + next,0);if (typeofnamed.andThenMultiplyBy ==='number') { total *=named.andThenMultiplyBy; }return total;});exportdefault add;
Modifiers
A modifier's Args are split into Named and Positional as with helpers, but unlike helpers they have no Return, since modifiers don't return a value. Their signtures can, however, specify the type of DOM Element they are compatible with.