Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 748 Bytes

README.md

File metadata and controls

32 lines (23 loc) · 748 Bytes

💬 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: -]