Import `computed.bool` from the right package
aoumiri opened this issue · 8 comments
With the latest release of ember 3.27.0
, it's no longer possible to use computed.bool
like that:
import { computed } from '@ember/object';
// ...
someAttribute: computed.bool('someTrackedProperty'),
// ...
But instead we should do:
import { bool } from '@ember/object/computed';
// ...
someAttribute: bool('someTrackedProperty'),
// ...
Otherwise, this is the error we get: Uncaught TypeError: Ember.computed.bool is not a function
.
@aoumiri I don't understand why this error exists (we encountered the same error) while Ember.computed.bool
is only deprecated in Ember 3.27.0 and should stay deprecated until Ember 4.0.0 , so it should not cause an error...
Did I miss something or am I completely dumb ?
I'm encountering this with ember-moment
8.0.1
on ember-source
3.28.0
running the following in a template:
{{moment-format (now) 'YYYY'}}
Throws the error:
Uncaught TypeError: Ember.computed.bool is not a function
at Module.callback (-base.js:10)
at Module.exports (loader.js:106)
at Module._reify (loader.js:143)
at Module.reify (loader.js:130)
at Module.exports (loader.js:104)
at Module._reify (loader.js:143)
at Module.reify (loader.js:130)
at Module.exports (loader.js:104)
at requireModule (loader.js:27)
at Class._extractDefaultExport (index.js:462)
Which seems to relate to here:
Just to note, the PR from here fixes this for me:
You can get it with:
yarn add stefanpenner/ember-moment#351/head
@jasonmit @stefanpenner can anyone of you have a look at this PR? Or any maintainer 🙏
Thanks 😊
Isn't this an ember bug? I am getting these same errors from app code when it was just meant to be a deprecation.
Ember bug or not, I think it's still worth fixing now if it will be deprecated. Rather than waiting for the next major. WDYT ?
Fix released in 8.0.2