Giter Club home page Giter Club logo

Comments (3)

 avatar commented on June 20, 2024

Interesting, I can't repro this, it works fine for me:

image

Do you think it's maybe because you're using require() instead of import?

Maybe because the type declaration module uses declare module { } it only works if you're using module-style imports?

Also what version of the package are you running?

from emoji-regex.

rabarrota avatar rabarrota commented on June 20, 2024

Yup, I'm assuming that's the problem. I'm using cjs so it doesn't look like the type declaration supports it.

I'm using 10.2.1

from emoji-regex.

vdh avatar vdh commented on June 20, 2024

The index.d.ts should be updated to this instead:

diff --git a/index.d.ts b/index.d.ts
index 6f57555090390e09a3b3a2e39bab037c995b47b9..beb73be29022bf20734057e38148282207f5fa2b 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -1,3 +1,4 @@
 declare module 'emoji-regex' {
-  export default function emojiRegex(): RegExp;
+  function emojiRegex(): RegExp;
+  export = emojiRegex;
 }

It looks like it was changed by #89 for the index.mjs file but that then broke types for the index.js file. With split files like this, it should probably be defined directly inside those files as JSDoc instead if they're going to vary in typing like that.

from emoji-regex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.