From fb4a4dd9dd2a5f356a680af39745c0d4c8dc2371 Mon Sep 17 00:00:00 2001 From: Alexey Molchan Date: Sat, 30 Apr 2022 01:34:13 +0300 Subject: [PATCH] cleanup types --- index.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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; };