feat(@types/emoji-js) create types (#39026)

This commit is contained in:
Jason Di Benedetto 2019-10-15 06:21:47 +10:30 committed by Armando Aguirre
parent 122f665640
commit 2250810353
4 changed files with 95 additions and 0 deletions

View File

@ -0,0 +1,24 @@
import emojijs = require('emoji-js');
const emoji = new emojijs.EmojiConvertor();
emoji.replace_colons(':smile:');
emoji.replace_unified('\u{1F604}');
emoji.text_mode = true;
emoji.include_title = true;
emoji.img_sets.apple.path = 'http://my-cdn.com/emoji-apple-64/';
emoji.img_sets.apple.sheet = 'http://my-cdn.com/emoji-apple-sheet-64.png';
emoji.use_sheet = true;
emoji.addAliases({
doge: '1f415',
cat: '1f346',
});
emoji.removeAliases(['doge', 'cat']);

47
types/emoji-js/index.d.ts vendored Normal file
View File

@ -0,0 +1,47 @@
// Type definitions for emoji-js 3.4
// Project: https://github.com/iamcal/js-emoji
// Definitions by: Jason Di Benedetto <https://github.com/jasondibenedetto>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export as namespace EmojiConvertor;
export class EmojiConvertor {
addAliases: (aliases: { [key: string]: string }) => void;
allow_caps: boolean;
allow_native: boolean;
avoid_ms_emoji: boolean;
colons_mode: boolean;
img_set: string;
img_sets: { [key: string]: { path: string; sheet: string; sheet_size: number; mask: number } };
include_text: boolean;
include_title: boolean;
img_suffix: string;
removeAliases: (aliases: string[]) => void;
replace_colons: (str: string) => string;
replace_emoticons: (str: string) => string;
replace_emoticons_with_colons: (str: string) => string;
replace_mode: string;
replace_unified: (str: string) => string;
text_mode: boolean;
use_css_imgs: boolean;
use_sheet: boolean;
}

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"emoji-js-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }