Skip to content

API Reference / @gtkx/i18n / ErrorArgs

Type Alias: ErrorArgs

ErrorArgs = readonly [string, ErrorMeta | undefined, ...any[]]

Defined in: node_modules/.pnpm/react-i18next@17.0.12_i18next@26.4.0_typescript@6.0.3__react@19.2.8_typescript@6.0.3/node_modules/react-i18next/TransWithoutContext.d.ts:158

Use to type the logger arguments

Example

import type { ErrorArgs } from 'react-i18next';

const logger = {
  // ....
  warn: function (...args: ErrorArgs) {
     if (args[1]?.code === 'TRANS_INVALID_OBJ') {
       const [msg, { i18nKey, ...rest }] = args;
       return log(i18nKey, msg, rest);
     }
     log(...args);
  }
}
i18n.use(logger).use(i18nReactPlugin).init({...});

Released under the MPL-2.0 License.