generate
Generate the .d.ts from previously pulled JSON.
Generates the typed .d.ts from JSON already written by lb pull.
Aliased as lb types.
lb generate --project my-app --out src/@types/resources.d.ts
lb types --no-params # keys onlyExample output
From a pulled common.json (welcome: "Welcome", greeting: "Hi {{name}}"),
generate writes:
// Generated by @language-bridge/cli — do not edit.
// Source locale: en. Re-run `lb sync` to update.
/* eslint-disable */
export interface Resources {
"common": {
"greeting": string;
"welcome": string;
};
}
export type TranslationParams = {
"common:greeting": { "name": string | number };
"common:welcome": {};
};
declare module "i18next" {
interface CustomTypeOptions {
defaultNS: "common";
resources: Resources;
}
}Options
| Flag | Default | Notes |
|---|---|---|
-o, --out <path> | src/@types/resources.d.ts | Output .d.ts path. |
--no-params | — | Skip interpolation-param types (keys only). |
Plus the common options. See Typed i18next for wiring the result into i18next.