Skip to content

Commit 7564df0

Browse files
committed
client: Set fallback value for LocalizationContext
Reduces the number of errors reported by TypeScript compiler in strict mode from 398 to 294.
1 parent ff095c4 commit 7564df0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

client/js/helpers/i18n.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ export function i18nFormat(
116116
return formatted;
117117
}
118118

119-
export const LocalizationContext = React.createContext(undefined);
119+
export const LocalizationContext = React.createContext<Translate>(() => {
120+
throw new Error('Missing l10n context');
121+
});
120122

121123
export type Translate = (
122124
translated: MessageKey,

0 commit comments

Comments
 (0)