1
0
mirror of https://github.com/twitter/twemoji.git synced 2024-06-15 03:35:16 +00:00

update types

This commit is contained in:
Alexey Molchan 2022-04-30 00:24:10 +03:00
parent cf0abdf325
commit 50a6a0de47

9
index.d.ts vendored
View File

@ -9,6 +9,8 @@
*/ */
declare type ParseCallback = (icon: string, options: object, variant: string) => string | false; declare type ParseCallback = (icon: string, options: object, variant: string) => string | false;
declare type Replacer = (substring: string, ...args: any[]) => string;
declare interface TwemojiOptions { declare interface TwemojiOptions {
/** /**
* Default: MaxCDN * Default: MaxCDN
@ -45,6 +47,10 @@ declare interface TwemojiOptions {
} }
declare type Twemoji = { declare type Twemoji = {
base: string;
ext: string;
className: string;
size: string | number;
convert: { convert: {
/** /**
* Given an HEX codepoint, returns UTF16 surrogate pairs. * Given an HEX codepoint, returns UTF16 surrogate pairs.
@ -79,6 +85,9 @@ declare type Twemoji = {
toCodePoint(utf16surrogatePairs: string, sep?: string): string; toCodePoint(utf16surrogatePairs: string, sep?: string): string;
}; };
parse<T extends string | HTMLElement>(node: T, options?: TwemojiOptions | ParseCallback): T; parse<T extends string | HTMLElement>(node: T, options?: TwemojiOptions | ParseCallback): T;
replace(text: string, replacer: string | Replacer): string;
test(test: string): boolean;
onerror(): void;
}; };
declare module 'twemoji' { declare module 'twemoji' {