diff options
Diffstat (limited to 'src/index.d.ts')
| -rw-r--r-- | src/index.d.ts | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/index.d.ts b/src/index.d.ts index 1e6a886..002b179 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -53,6 +53,31 @@ declare const BUILD_MANIFEST_ASSETS: []; declare const BUILD_VERSION: string; -declare var hyphenationPatternsEnUs; -declare var hyphenationPatternsRu; -declare var createHyphenator; +/** Pattern definition as produced by the hyphen library's build process. */ +interface HyphenPatternDefinition { + patterns: string[]; + exceptions?: string[]; +} + +/** Optional configuration for createHyphenator. */ +interface CreateHyphenatorOptions { + async?: boolean; + debug?: boolean; + html?: boolean; + hyphenChar?: string; + minWordLength?: number; +} + +/** A hyphenation function: takes text, returns hyphenated HTML, technically this could also return a promise in async mode but we don't use it */ +interface HyphenatorFunction { + (text: string, options?: { debug?: boolean; hyphenChar?: string; minWordLength?: number }): string | Promise<string> +} + +/** Language-code -> hyphenator function map. */ +type HyphenateMap = Record<string, HyphenatorFunction>; + +declare var hyphenationPatternsEnUs: HyphenPatternDefinition; +declare var hyphenationPatternsRu: HyphenPatternDefinition; +declare var createHyphenator: { + (patternsDefinition: HyphenPatternDefinition, options?: CreateHyphenatorOptions): HyphenatorFunction; +}; |
