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.73k stars 174 forks source link

Provide correct export types for CJS module #63

Closed HitoriSensei closed 3 years ago

HitoriSensei commented 4 years ago

Since module export format is CJS, TypeScript should be informed about the fact by using export = instead of export default.

export default is for ES modules, and when is used to declare exports of a CJS module (which doesn't have a "default" export) in a certain build/bundle config scenarios it can create a runtime bugs (Uncaught TypeError: es2015_1.default is not a function)

mike-north commented 4 years ago

Thanks for this fix @HitoriSensei! This is a common bug that folks with "esModuleInterop": true in their tsconfig.json (and compiling TS with tsc) may not notice.

Richienb commented 4 years ago

@mathiasbynens Please merge this PR.