Type Safety

Type safety in Intor is enforced at compile time. It applies to the entire message structure and translation flow.


Typed Aspects

AspectMeaningUsage
Localesupported localesdefined in supportedLocales
Keytranslation keysfirst argument of t and tRich
Replacementinterpolation valuessecond argument of t, third of tRich
Richrich text tag handlerssecond argument of tRich

preKey is also type-safe and narrows keys at the type level.

Per-config Type Switching

Each configuration maintains its own isolated type context.
Switching the target Config switches the entire type surface accordingly.


Integration Steps

♯1 Generate Types

Use the interactive CLI to guide the type generation process.

The CLI automatically generates type definitions and corresponding schema files, and outputs them to the .intor/ directory.

npx intor-cli

For more CLI features and usage, see: CLI .

♯2 Configure tsconfig.json

Add the following to your tsconfig.json:

{
  "include": [
    ".intor/**/*.d.ts"
  ]
}