DefinitelyTyped/types/fluent/index.d.ts
James Nimlos d9437c4fd6 Update fluent definitions for v0.11 (#33859)
* update fluent definitions for v0.11

* remove circular reference

* add typescript version requiring fix

* downgrade ts version

definitelytyped-header-parser errors on prereleases versions but
TS v3.4 is not actually released so it also errors
2019-03-25 09:38:31 -07:00

40 lines
1.3 KiB
TypeScript

// Type definitions for fluent 0.11
// Project: http://projectfluent.org
// Definitions by: Huy Nguyen <https://github.com/huy-nguyen>, James Nimlos <https://github.com/jamesnimlos>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export interface FluentBundleContructorOptions {
functions?: object;
useIsolating?: boolean;
transform?: (...args: any[]) => any;
}
export class FluentType {
constructor(value: any, opts: object);
toString(bundle: FluentBundle): string;
valueOf(): any;
}
export class FluentNone extends FluentType {}
export class FluentNumber extends FluentType {}
export class FluentDateTime extends FluentType {}
export type FluentNode = FluentType | string;
export class FluentResource extends Map {
static fromString(source: string): FluentResource;
}
export class FluentBundle {
constructor(locales: string | string[], options?: FluentBundleContructorOptions);
messages: IterableIterator<[string, FluentNode[]]>;
hasMessage(source: string): boolean;
addMessages(source: string): string[];
getMessage(id: string): FluentNode[];
format(message: FluentNode[], args?: object, errors?: string[]): string;
addResource(res: FluentResource): string[];
}
export function ftl(strings: TemplateStringsArray): string;