errors: added changeset for new assertion helpers

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-10-07 12:17:33 +02:00
parent 93c537f40a
commit 6077d61e73
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/errors': patch
---
Two new helpers have been added that make it easier to migrate to considering thrown errors to be of the type `unknown` in TypeScript. The helpers are `assertError` and `isError`, and can be called to make sure that an unknown value conforms to the shape of an `ErrorLike` object. The `assertError` function is a type-guard that throws in the case of a mismatch, while `isError` returns false.