ember-deep-tracked
ember-deep-tracked copied to clipboard
Error if object is undefined
With native @tracked you can defined your tracked properties with no default values.
@tracked foo;
@tracked bar;
Even though as objects ember won't track these, the user is used to write it this way. When you start to use this addon, without adding = {} you get the following error

vendor.js:172922 Uncaught (in promise) TypeError: initializer is not a function
desc.get = function get() {
if (!value) {
value = deepTracked(initializer());
}
is where the error is.
I think if you're using this addon, and you're trying to track the properties of an object, perhaps it could default to empty object? Or fail with a warning instead.
I think defaulting to {} sounds good 🎉
I'd gladly accept a PR that adds that, too <3