frontend icon indicating copy to clipboard operation
frontend copied to clipboard

Fix localize key type errors for states

Open steverep opened this issue 2 years ago • 1 comments

Proposed change

The goal here is to remove the 3 localize exceptions for state*:

  • Replace instances of UNAVAILABLE_STATES.includes with the new type predicate function isUnavailableState. This is the bulk of the files touched so it might help to review this commit separately as all changes are identical.
  • Use new literal types for climate attributes. This exposed a bug where the fan only action was missing from the tile card badge so I added it (cc @piitaya).
  • Use a literal type for humidifier entity state, and cast an instance for the entity row to use the humidifier entity type.
  • Use literal types where the state label is truncated for badges.

Type of change

  • [ ] Dependency upgrade
  • [x] Bugfix (non-breaking change which fixes an issue)
  • [ ] New feature (thank you!)
  • [ ] Breaking change (fix/feature causing existing functionality to break)
  • [x] Code quality improvements to existing code or addition of tests

Example configuration


Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

Checklist

  • [x] The code change is tested and works locally.
  • [x] There is no commented out code in this PR.
  • [ ] Tests have been added to verify that the new code works.

steverep avatar Dec 10 '22 17:12 steverep

I used the satisfies operator, so the prettier check will pass once #14694 is merged.

steverep avatar Dec 10 '22 19:12 steverep