Default export has no call signatures
I'm trying to import the default export from
npm:@feathersjs/express
, but Deno complains that the default export has no call signatures.
However, running main.ts
works without issue.
The referenced index.d.ts
contains this:
So Deno should see its default export.
The strange thing is that the following works when checking the file and running it.
And the following check returns true
:
So why doesn't Deno like it when I use express()
instead of express.default()
?1 Reply
I wasn't able to find the answer to your question in the official Deno documentation. However, based on the error message and the code snippet you've provided, it seems like there might be an issue with how the default export is being handled.
In TypeScript, when you import a default export, you're importing the
default
property of the module. The error message suggests that Deno is not recognizing the default export as a callable function, even though it is defined as such in the index.d.ts
file.
The fact that express === express.default
returns true
indicates that the default export is indeed the function you're trying to call, but for some reason, Deno's type checking is not interpreting it correctly.
As a workaround, explicitly calling express.default()
seems to resolve the issue, as you've discovered. This is not an ideal solution, but it might be necessary until the underlying issue with the type checking is resolved.
Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of the advice given. It might also be helpful to look for similar issues in the Deno repository on GitHub or to ask for help from the community to see if others have encountered and resolved this problem.Helpful Links:
Deno 1.4 Release Notes
Deno Runtime Quick Start | Deno Docs
Importing & Exporting - Deno by Example
Build Apps in Deno with Frameworks such as React, Vue, Express, and more.
How to publish Deno modules to NPM
ECMAScript Modules in Deno | Deno Docs
Deno 1.37: Modern JavaScript in Jupyter Notebooks