mathiasbynens / emoji-regex

A regular expression to match all Emoji-only symbols as per the Unicode Standard.
https://mths.be/emoji-regex
MIT License
1.72k stars 175 forks source link

typescript synthetic import #89

Closed nstringham closed 1 year ago

nstringham commented 3 years ago

when using emoji-regex with es style imports such as

import emojiRegex from 'emoji-regex/es2015/RGI_Emoji';

typescript gives the following error:

This module is declared with using 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.

looking at the typescript documentation for default exports it looks like

export = emojiRegex;

should be replaced by

export default emojiRegex;

inside each .d.ts file I tried making this change manually inside my node_modules folder and it seems to resolve the issue

note: this is a regression because it used to work in v9.2.0 but it doesn't work in v9.2.2

mathiasbynens commented 2 years ago

Does anyone wanna submit a patch?

nstringham commented 2 years ago

@mathiasbynens if you don't like #99 I can make a PR that only include the typescript fix.