Unverified Commit 8efcdbed authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

Use TypeScript to check if a default case is required in `switch` (#75854)

parent ef6ecdb4
...@@ -21,17 +21,13 @@ export type SupportedErrorEvent = { ...@@ -21,17 +21,13 @@ export type SupportedErrorEvent = {
function getErrorSignature(ev: SupportedErrorEvent): string { function getErrorSignature(ev: SupportedErrorEvent): string {
const { event } = ev const { event } = ev
// eslint-disable-next-line default-case -- TypeScript checks this
switch (event.type) { switch (event.type) {
case ACTION_UNHANDLED_ERROR: case ACTION_UNHANDLED_ERROR:
case ACTION_UNHANDLED_REJECTION: { case ACTION_UNHANDLED_REJECTION: {
return `${event.reason.name}::${event.reason.message}::${event.reason.stack}` return `${event.reason.name}::${event.reason.message}::${event.reason.stack}`
} }
default:
break
} }
event satisfies never
return ''
} }
export function useErrorHook({ export function useErrorHook({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment