From 615ced3dda6a175115fe360ee686eafcba13ddff Mon Sep 17 00:00:00 2001 From: Carlos Cuesta Date: Mon, 2 Jan 2023 12:38:12 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20Add=20TypeScript=20type?= =?UTF-8?q?=20declarations=20to=20`gitmojis`=20package=20(#1247)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🏷️ Add `gitmojis.d.ts` TypeScript module declaration * 🔧 Add `types` field to `package.json` --- packages/gitmojis/package.json | 1 + packages/gitmojis/src/gitmojis.d.ts | 34 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 packages/gitmojis/src/gitmojis.d.ts diff --git a/packages/gitmojis/package.json b/packages/gitmojis/package.json index ba5afa1..0f0f896 100644 --- a/packages/gitmojis/package.json +++ b/packages/gitmojis/package.json @@ -6,6 +6,7 @@ "files": [ "src/gitmojis.json" ], + "types": "src/gitmojis.d.ts", "scripts": { "lint": "jsonlint ./src/gitmojis.json -V ./src/schema.json", "publishPackage": "npm publish" diff --git a/packages/gitmojis/src/gitmojis.d.ts b/packages/gitmojis/src/gitmojis.d.ts new file mode 100644 index 0000000..f3b7b58 --- /dev/null +++ b/packages/gitmojis/src/gitmojis.d.ts @@ -0,0 +1,34 @@ +declare module 'gitmojis' { + type Gitmoji = { + /** + * Gitmoji unicode character + * @example '🎨', '⚡️', '🔥', '🐛' + */ + readonly emoji: string; + /** + * Gitmoji hexadecimal entity. + * @example '🎨', '⚡', '🔥', '🐛' + */ + readonly entity: `&#${string};`; + /** + * Gitmoji use-case description. + */ + readonly description: string; + /** + * Gitmoji name. + * @example 'art', 'zap', 'fire', 'bug' + */ + readonly name: string; + /** + * Gitmoji semver range. Can be `null` if not specified. + */ + readonly semver: 'patch' | 'minor' | 'major' | null; + /** + * Gitmoji character formatted as a shortcode. + * @example ':art:', ':zap:', ':fire:', ':bug:' + */ + readonly code: `:${string}:`; + } + + export const gitmojis: readonly Gitmoji[]; +}