Skip to content

Commit

Permalink
Fix TS 4.8
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Jan 9, 2024
1 parent 1d8ea87 commit 2030928
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test-app/tests/unit/registerUsable-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,20 @@ module('API | registerUsable', function (hooks) {
instance.foo;
assert.notOk(true, 'Should not get here');
} catch (e) {
// Not until TS 4.9 is the default "e" an `unknown` type
let error = e as any;

debugAssert(
'Expected error to have a message property',
typeof e === 'object' && e !== null && 'message' in e && typeof e.message === 'string'
typeof error === 'object' &&
error !== null &&
'message' in error &&
typeof error.message === 'string'
);

assert.ok(
e.message.match(new RegExp(expectedMessage)),
`Expected '${e.message}' to include '${expectedMessage}'`
error.message.match(new RegExp(expectedMessage)),
`Expected '${error.message}' to include '${expectedMessage}'`
);
}
});
Expand Down

0 comments on commit 2030928

Please sign in to comment.