« All deprecation guides
Deprecation Guide for Deprecate import readOnly from @ember/object/computed
until: 7.0.0
id: deprecate-import-read-only-from-object-computed
readOnly
from @ember/object/computed
is deprecated.
Migration
Use a getter that returns the underlying value.
Before:
import { readOnly } from '@ember/object/computed';
class Person {
firstName = 'Tom';
@readOnly('firstName') givenName;
}
After:
class Person {
firstName = 'Tom';
get givenName() { return this.firstName; }
}
Don't define a setter to keep it effectively read-only.