diff --git a/index.d.ts b/index.d.ts index f4250cac..ad55c5d3 100644 --- a/index.d.ts +++ b/index.d.ts @@ -9,7 +9,9 @@ */ type ParseCallback = (icon: string, options: object, variant: string) => string | false; -type Replacer = (substring: string, ...args: any[]) => string; +type ReplacerFunction = (substring: string, ...args: any[]) => string; + +type Replacer = string | ReplacerFunction; interface TwemojiOptions { /** @@ -85,7 +87,7 @@ type Twemoji = { toCodePoint(utf16surrogatePairs: string, sep?: string): string; }; parse(node: T, options?: TwemojiOptions | ParseCallback): T; - replace(text: string, replacer: string | Replacer): string; + replace(text: string, replacer: Replacer): string; test(text: string): boolean; onerror(): void; };