From 47db606d06c0e35a084911bfb00ffc528e2187a5 Mon Sep 17 00:00:00 2001 From: Alexey Molchan Date: Sat, 30 Apr 2022 01:29:16 +0300 Subject: [PATCH] update types --- index.d.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/index.d.ts b/index.d.ts index ffed054a..f4250cac 100644 --- a/index.d.ts +++ b/index.d.ts @@ -7,9 +7,11 @@ * @param options all info for this parsing operation * @param variant the optional \uFE0F ("as image") variant, in case this info is anyhow meaningful. By default this is ignored. */ -declare type ParseCallback = (icon: string, options: object, variant: string) => string | false; +type ParseCallback = (icon: string, options: object, variant: string) => string | false; -declare interface TwemojiOptions { +type Replacer = (substring: string, ...args: any[]) => string; + +interface TwemojiOptions { /** * Default: MaxCDN */ @@ -44,7 +46,11 @@ declare interface TwemojiOptions { attributes?(icon: string, variant: string): object; } -declare type Twemoji = { +type Twemoji = { + base: string; + ext: string; + className: string; + size: string; convert: { /** * Given an HEX codepoint, returns UTF16 surrogate pairs. @@ -79,6 +85,9 @@ declare type Twemoji = { toCodePoint(utf16surrogatePairs: string, sep?: string): string; }; parse(node: T, options?: TwemojiOptions | ParseCallback): T; + replace(text: string, replacer: string | Replacer): string; + test(text: string): boolean; + onerror(): void; }; declare module 'twemoji' {