From f3376775662f9ae583c12a7ba490f2fae60c81a4 Mon Sep 17 00:00:00 2001 From: Danilo Bargen Date: Tue, 13 Dec 2016 09:46:17 +0100 Subject: [PATCH 1/5] Add emojione type declarations --- emojione/emojione-test.ts | 15 +++++++++++++++ emojione/emojione.d.ts | 20 ++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 emojione/emojione-test.ts create mode 100644 emojione/emojione.d.ts diff --git a/emojione/emojione-test.ts b/emojione/emojione-test.ts new file mode 100644 index 0000000000..cdb38d7c90 --- /dev/null +++ b/emojione/emojione-test.ts @@ -0,0 +1,15 @@ +/// + +emojione.sprites = true; +emojione.imagePathPNG = 'foobar'; +emojione.imagePathSVG = 'foobar'; +emojione.imagePathSVGSprites = 'foobar'; +emojione.imageType = 'svg'; +emojione.unicodeAlt = false; +emojione.ascii = true; +emojione.unicodeRegexp = '123.*'; +emojione.cacheBustParam = 'asdf'; +const myShort: string = emojione.toShort('hi'); +const myImage1: string = emojione.toImage('hi'); +const myImage2: string = emojione.shortnameToImage('hi'); +const myImage3: string = emojione.unicodeToImage('hi'); diff --git a/emojione/emojione.d.ts b/emojione/emojione.d.ts new file mode 100644 index 0000000000..f273d34460 --- /dev/null +++ b/emojione/emojione.d.ts @@ -0,0 +1,20 @@ +// Type definitions for emojione +// Project: https://github.com/Ranks/emojione +// Definitions by: Danilo Bargen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare var emojione: { + sprites: boolean, + imagePathPNG: string, + imagePathSVG: string, + imagePathSVGSprites: string, + imageType: 'png' | 'svg', + unicodeAlt: boolean, + ascii: boolean, + unicodeRegexp: string, + cacheBustParam: string, + toShort: (str: string) => string, + toImage: (str: string) => string, + shortnameToImage: (str: string) => string, + unicodeToImage: (str: string) => string, +}; From 43a2d51e2dad723f54e2f67c592d725e931debd1 Mon Sep 17 00:00:00 2001 From: Danilo Bargen Date: Tue, 13 Dec 2016 17:10:36 +0100 Subject: [PATCH 2/5] Update emojione format --- .../{emojione-test.ts => emojione-tests.ts} | 2 +- emojione/{emojione.d.ts => index.d.ts} | 0 emojione/tsconfig.json | 19 +++++++++++++++++++ emojione/tslint.json | 1 + 4 files changed, 21 insertions(+), 1 deletion(-) rename emojione/{emojione-test.ts => emojione-tests.ts} (92%) rename emojione/{emojione.d.ts => index.d.ts} (100%) create mode 100644 emojione/tsconfig.json create mode 100644 emojione/tslint.json diff --git a/emojione/emojione-test.ts b/emojione/emojione-tests.ts similarity index 92% rename from emojione/emojione-test.ts rename to emojione/emojione-tests.ts index cdb38d7c90..075b9c530e 100644 --- a/emojione/emojione-test.ts +++ b/emojione/emojione-tests.ts @@ -1,4 +1,4 @@ -/// +/// emojione.sprites = true; emojione.imagePathPNG = 'foobar'; diff --git a/emojione/emojione.d.ts b/emojione/index.d.ts similarity index 100% rename from emojione/emojione.d.ts rename to emojione/index.d.ts diff --git a/emojione/tsconfig.json b/emojione/tsconfig.json new file mode 100644 index 0000000000..67f76849f1 --- /dev/null +++ b/emojione/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "emojione-tests.ts" + ] +} diff --git a/emojione/tslint.json b/emojione/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/emojione/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From 737b44634be870c6fb435fc2f660acecce523769 Mon Sep 17 00:00:00 2001 From: Danilo Bargen Date: Tue, 13 Dec 2016 18:00:59 +0100 Subject: [PATCH 3/5] Remove reference from tests --- emojione/emojione-tests.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/emojione/emojione-tests.ts b/emojione/emojione-tests.ts index 075b9c530e..ea5d04e217 100644 --- a/emojione/emojione-tests.ts +++ b/emojione/emojione-tests.ts @@ -1,5 +1,3 @@ -/// - emojione.sprites = true; emojione.imagePathPNG = 'foobar'; emojione.imagePathSVG = 'foobar'; From 2fc133fc04d4b5a3a67f7e47559a122eb91dcd0a Mon Sep 17 00:00:00 2001 From: Danilo Bargen Date: Tue, 13 Dec 2016 18:01:08 +0100 Subject: [PATCH 4/5] Export as namespace --- emojione/index.d.ts | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/emojione/index.d.ts b/emojione/index.d.ts index f273d34460..f6136f04e0 100644 --- a/emojione/index.d.ts +++ b/emojione/index.d.ts @@ -3,18 +3,18 @@ // Definitions by: Danilo Bargen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare var emojione: { - sprites: boolean, - imagePathPNG: string, - imagePathSVG: string, - imagePathSVGSprites: string, - imageType: 'png' | 'svg', - unicodeAlt: boolean, - ascii: boolean, - unicodeRegexp: string, - cacheBustParam: string, - toShort: (str: string) => string, - toImage: (str: string) => string, - shortnameToImage: (str: string) => string, - unicodeToImage: (str: string) => string, -}; +export as namespace emojione; + +export var sprites: boolean; +export var imagePathPNG: string; +export var imagePathSVG: string; +export var imagePathSVGSprites: string; +export var imageType: 'png' | 'svg'; +export var unicodeAlt: boolean; +export var ascii: boolean; +export var unicodeRegexp: string; +export var cacheBustParam: string; +export function toShort(str: string): string; +export function toImage(str: string): string; +export function shortnameToImage(str: string): string; +export function unicodeToImage(str: string): string; From c0fcdc35058d8f6131946e5be3906e3db8642d71 Mon Sep 17 00:00:00 2001 From: Danilo Bargen Date: Wed, 14 Dec 2016 19:45:13 +0100 Subject: [PATCH 5/5] Add version to header --- emojione/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emojione/index.d.ts b/emojione/index.d.ts index f6136f04e0..48b55e87cd 100644 --- a/emojione/index.d.ts +++ b/emojione/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for emojione +// Type definitions for emojione 2.2 // Project: https://github.com/Ranks/emojione // Definitions by: Danilo Bargen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped