1
0
mirror of https://github.com/twitter/twemoji.git synced 2024-09-28 14:50:59 +00:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Alexey Molchan
ad3d3d669b export types 2022-04-30 01:28:09 -07:00
Alexey Molchan
000dc9a7c6 removed type alias 2022-04-30 01:28:09 -07:00
Alexey Molchan
fb4a4dd9dd cleanup types 2022-04-30 01:28:09 -07:00
Alexey Molchan
47db606d06 update types 2022-04-30 01:28:09 -07:00

15
index.d.ts vendored
View File

@ -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;
export type ParseCallback = (icon: string, options: object, variant: string) => string | false;
declare interface TwemojiOptions {
export type ReplacerFunction = (substring: string, ...args: any[]) => string;
export type TwemojiOptions = {
/**
* Default: MaxCDN
*/
@ -44,7 +46,11 @@ declare interface TwemojiOptions {
attributes?(icon: string, variant: string): object;
}
declare type Twemoji = {
export 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<T extends string | HTMLElement>(node: T, options?: TwemojiOptions | ParseCallback): T;
replace(text: string, replacer: string | ReplacerFunction): string;
test(text: string): boolean;
onerror(): void;
};
declare module 'twemoji' {