-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
status: blocked on external APIWaiting for an external dependency...Waiting for an external dependency...type: featureNew enhancement or request 🚀New enhancement or request 🚀
Description
In my TypeScript book, I’m using @ts-expect-error with error messages to point out if there are errors – e.g.:
function func(value: unknown) {
// @ts-expect-error: Object is of type 'unknown'.
value.toFixed(2);
// Type assertion:
(value as number).toFixed(2); // OK
}Benefit: Very similar to assert.throws() in that type checking doesn’t fail if everything is as expected.
All examples from my book: https://gist.github.com/rauschma/4d1ee06e47e03545d4c4b31b59700786
Metadata
Metadata
Assignees
Labels
status: blocked on external APIWaiting for an external dependency...Waiting for an external dependency...type: featureNew enhancement or request 🚀New enhancement or request 🚀