TrackedArray
from tracked-built-ins instead of the classic EmberArray:inject
decorator. Because decorators can't affect the type of the property they decorate, we must manually type the property. Also, we must use declare
modifier to tell the TypeScript compiler to trust that this property will be set up by something outside this component—namely, the decorator.ShoppingCartService
we defined above in a component:ShoppingCartService
in order to get any type-safety because the lookup return type is any
(see caution below).service:<name>
) to the service class, a typo would result in returning something other than the specified type. It only gurantees that if the expected service is returned that you are using it correctly.