@dcoffey/espells
Version:
Pure JS/TS spellchecker, using Hunspell dictionaries. Based on Spylls.
51 lines (50 loc) • 1.79 kB
TypeScript
import type { SuggestionKind } from "../constants.js";
/** The object that the {@link Suggest} class uses internally for tracking suggestions. */
export declare class Suggestion {
/** The actual suggested text. */
text: string;
/** Describes what actually generated this suggestion. */
kind: SuggestionKind;
constructor(
/** The actual suggested text. */
text: string,
/** Describes what actually generated this suggestion. */
kind: SuggestionKind);
/**
* Returns a new {@link Suggestion}, cloned from this current instance,
* but with any properties given replaced.
*/
replace(text?: string, kind?: SuggestionKind): Suggestion;
}
/**
* Like the usual {@link Suggestion}, but instead stores a list of words
* that represents the entire suggestion.
*/
export declare class MultiWordSuggestion {
/** The list of words that represents this suggestion. */
words: string[];
/** Describes what actually generated this suggestion. */
kind: SuggestionKind;
/**
* If true, this suggestion is allowed to be given to the user with
* dashes joining the words together.
*/
allowDash: boolean;
constructor(
/** The list of words that represents this suggestion. */
words: string[],
/** Describes what actually generated this suggestion. */
kind: SuggestionKind,
/**
* If true, this suggestion is allowed to be given to the user with
* dashes joining the words together.
*/
allowDash?: boolean);
/**
* Converts this multi-word suggestion into a normal {@link Suggestion} by
* joining the words list together.
*
* @param seperator - The separator to use. Defaults to a space.
*/
stringify(seperator?: string): Suggestion;
}