« All deprecation guides

Deprecation Guide for Deprecate import bool from @ember/object/computed

until: 7.0.0
id: deprecate-import-bool-from-object-computed

bool from @ember/object/computed is deprecated. It coerced the value of another property to a boolean.

Migration

Use a getter wrapping Boolean(...) or !!.

Before:

import { bool } from '@ember/object/computed';
class State {
  selectedItem = null;
  @bool('selectedItem') hasSelection;
}

After:

class State {
  selectedItem = null;
  get hasSelection() { return Boolean(this.selectedItem); }
}