mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
🤖 Merge PR #44526 Fixed missing file in package of [types/hyphen] by @krisztianb
* Update index.d.ts Member "locale" of interface "JsonDataHeader" was renamed to "language". * Update gettext.js-tests.ts Updated test according to type definition changes. * Updated version number to 0.8 * Added type definition for hyphen * Fixed errors in tsconfig.json * Fixed errors reported by the linter * Updated tests for module hyphen * * Revert previous changes in test script * Added OTHER_FILES.txt to ignore unused declaration files in test script * Removed index.d.ts from OTHER_FILES.txt as it is the main file used also in the test * Added index.d.ts to files entry within tsconfig.json * Optimized parameter types with Readonly * Renamed common.ts to common.d.ts so that it is included in the npm package on packing. * Added comments Co-authored-by: Krisztián Balla <h1tm4n_@web.de>
This commit is contained in:
parent
9c96a1cd72
commit
f258742372
34
types/hyphen/common.d.ts
vendored
Normal file
34
types/hyphen/common.d.ts
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Hyphenation patterns and exceptions for a language.
|
||||
*/
|
||||
export interface PatternDefinitions {
|
||||
/** List of hyphenation patterns. */
|
||||
patterns: string[];
|
||||
|
||||
/** List of words with hyphenation points that don't fit the patterns. */
|
||||
exceptions: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for a hyphenation call.
|
||||
*/
|
||||
export interface HyphenationOptions {
|
||||
/** A boolean indicating, if the hyphenation function should output debug info to the console. Default is false. */
|
||||
debug?: boolean;
|
||||
|
||||
/** The value of the hyphen character that is inserted into the text. Default is \u00AD. */
|
||||
hyphenChar?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronous hyphenation function returning the hyphenated text immediately.
|
||||
*/
|
||||
export type HyphenationFunctionSync = (textToHyphenate: string, options?: Readonly<HyphenationOptions>) => string;
|
||||
|
||||
/**
|
||||
* Asynchronous hyphenation function returning a promise for the hyphenated text.
|
||||
*/
|
||||
export type HyphenationFunctionAsync = (
|
||||
textToHyphenate: string,
|
||||
options?: Readonly<HyphenationOptions>,
|
||||
) => Promise<string>;
|
||||
@ -1,16 +0,0 @@
|
||||
export interface PatternDefinitions {
|
||||
patterns: string[];
|
||||
exceptions: string[];
|
||||
}
|
||||
|
||||
interface HyphenationOptions {
|
||||
debug?: boolean;
|
||||
hyphenChar?: string;
|
||||
}
|
||||
|
||||
export type HyphenationFunctionSync = (textToHyphenate: string, options?: Readonly<HyphenationOptions>) => string;
|
||||
|
||||
export type HyphenationFunctionAsync = (
|
||||
textToHyphenate: string,
|
||||
options?: Readonly<HyphenationOptions>,
|
||||
) => Promise<string>;
|
||||
16
types/hyphen/index.d.ts
vendored
16
types/hyphen/index.d.ts
vendored
@ -4,13 +4,29 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
import { HyphenationFunctionAsync, HyphenationFunctionSync, PatternDefinitions } from './common';
|
||||
|
||||
/**
|
||||
* Options for the hyphenation factory function.
|
||||
*/
|
||||
interface FactoryOptions {
|
||||
/** If true the factory returns an asynchronous hyphenation function. Default is false. */
|
||||
async?: boolean;
|
||||
|
||||
/** A boolean indicating, if the hyphenation function should output debug info to the console. Default is false. */
|
||||
debug?: boolean;
|
||||
|
||||
/** The value of the hyphen character that is inserted into the text. Default is \u00AD. */
|
||||
hyphenChar?: string;
|
||||
|
||||
/** If true the hyphenation function is going to ignore HTML tags in the text. Default is false. */
|
||||
html?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a hyphenation function that can be used to hyphenate text.
|
||||
* @param patternsDefinition The hyphenation pattern definitions for a language.
|
||||
* @param options Settings for the hyphenation function.
|
||||
* @returns Depending on the options a synchronous or asynchronous hyphenation function.
|
||||
*/
|
||||
declare function createHyphenator(
|
||||
patternsDefinition: Readonly<PatternDefinitions>,
|
||||
options?: Readonly<FactoryOptions>,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user