Skip to content

CLI tool for generating TypeScript types for Project Fluent language files

License

Notifications You must be signed in to change notification settings

Benricheson101/fluent-types

Repository files navigation

💬 Fluent Types

Generate TypeScript type declarations for Fluent language files

Example Usage

fluent-types ./lang/en.ftl -o src/output.d.ts

import {MessageNames, Placeholders} from './output';

const get<Name extends MessageNames>(msg: Name, args: Placeholders<Name>): string {
  const pattern = bundle.getMessage(msg);
  return bundle.formatPattern(pattern.value, args);
};

CLI Usage

Fluent Types
Generate TypeScript type declarations for Fluent language files

USAGE:
    fluent-types [OPTIONS] <files>...

ARGS:
    <files>...    input fluent files

OPTIONS:
    -h, --help         Print help information
    -o <output>        the output file [default: -]