jdecked / twemoji-parser

A simple library for identifying emoji entities within a string in order to render them as Twemoji.
MIT License
19 stars 6 forks source link

Add d.ts so TypeScript users can use it #8

Closed k-kozika closed 6 months ago

k-kozika commented 6 months ago

Problem

This package is made with JavaScript, but since DT or .d.ts does not exist, it was not possible to use it with TypeScript. When I try to use it in TypeScript I get the following error:

Cannot find module '@twemoji/parser' or its corresponding type declarations.ts(2307)

Solution

This PR adds index.d.ts and make changes to the types and files fields of package.json

Result

This adds a type definition, so it can be used more safely in TypeScript.

k-kozika commented 6 months ago

This is a little related to #2. The unofficial DT is available at https://www.npmjs.com/package/@types/twemoji-parser, but it doesn't seem to be working because the package name has changed.

jdecked commented 6 months ago

OK, published on NPM here. Enjoy the types.