Avoid using as to cast values (#1115)

## Description:

- Use `<argument> is <type>` return type declarations in favor of `as`.
- Use `satisfies` instead of `as`.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
This commit is contained in:
Scott Anderson
2025-06-10 00:59:31 -04:00
committed by evanpelle
parent e45840c4cf
commit dccf2b3866
4 changed files with 19 additions and 15 deletions
+4 -4
View File
@@ -15,8 +15,8 @@ describe("getMessageTypeClasses", () => {
it("should return a valid CSS class for every MessageType", () => {
const messageTypes = Object.values(MessageType).filter(
(value) => typeof value === "number",
) as MessageType[];
(value): value is MessageType => typeof value === "number",
);
messageTypes.forEach((messageType) => {
const result = getMessageTypeClasses(messageType);
@@ -30,8 +30,8 @@ describe("getMessageTypeClasses", () => {
it("should not trigger console.warn for any MessageType", () => {
const messageTypes = Object.values(MessageType).filter(
(value) => typeof value === "number",
) as MessageType[];
(value): value is MessageType => typeof value === "number",
);
messageTypes.forEach((messageType) => {
getMessageTypeClasses(messageType);