Fix TypeScript type errors across multiple files
Some checks failed
Node.js CI / build (push) Has been cancelled

This commit is contained in:
Mike Cao 2026-02-05 21:25:46 -08:00
parent 860e6390f1
commit a3733b0424
12 changed files with 38 additions and 15 deletions

View file

@ -13,7 +13,7 @@ interface UseMessages {
messages: typeof messages;
labels: typeof labels;
getMessage: (id: string) => string;
getErrorMessage: (error: ApiError) => string | undefined;
getErrorMessage: (error: string | Error | ApiError) => string | undefined;
FormattedMessage: typeof FormattedMessage;
}
@ -26,12 +26,16 @@ export function useMessages(): UseMessages {
return message ? formatMessage(message) : id;
};
const getErrorMessage = (error: ApiError) => {
const getErrorMessage = (error: string | Error | ApiError) => {
if (!error) {
return undefined;
}
const code = error?.code;
if (typeof error === 'string') {
return error;
}
const code = (error as ApiError)?.code;
return code ? getMessage(code) : error?.message || 'Unknown error';
};

View file

@ -19,7 +19,7 @@ export function LanguageButton() {
</Icon>
</Button>
<Popover placement="bottom end">
<Dialog variant="menu">
<Dialog variant="sheet">
<Grid columns="repeat(3, minmax(200px, 1fr))" overflow="hidden">
{items.map(({ value, label }) => {
return (