question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

1.3.8 Error calling function

See original GitHub issue

Cannot invoke an expression whose type lacks a call signature. Type 'typeof import("C:/project/node_modules/rotating-file-stream/index")' has no compatible call signatures.

I think the definition file is wrong. I would also consider not using a default export.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:32 (23 by maintainers)

github_iconTop GitHub Comments

1reaction
kbirgercommented, Sep 23, 2018

I don’t have a example with me, but as of 1.3.7 I had

import * as rfs from 'rotating-file-stream'

and

const stream = rfs('file', opts).

As of 1.3.7 the types were any, so there was no issue. As of the type definition in 1.3.8 I started seeing the error described above. By changing the import to import rfs from 'rotating-file-stream', I was able to clear the error, but I was getting a null value for rfs when running the code. Honestly, in retrospect, it was probably because you define the export as RotatingFileStream, so I probably needed to do import RotatingFileStream`, but that also underscores a reason why default exports are considered to be a bad practice… https://basarat.gitbooks.io/typescript/docs/tips/defaultIsBad.html

@rakshith-ravi I’m not sure I understand your explanation for why you need to use default export. Other JS libraries get around it. Sure, it may take some refactoring, but it’s probably better for the health and utilization of this library in the long run.

@iccicci, I will try to clone your commit and try it out tomorrow, but I’m not sure if it relates to this issue (I could be wrong). Could you please post me a snippet of how you expect the module to be imported in TypeScript ?

0reactions
kbirgercommented, Aug 4, 2020

Is there any update here? It would be great to use the conventional import format, i.e.

import rfs from 'rotating-file-stream';

I don’t think that default import/exports are a “conventional” format. They are fairly problematic and bad for maintenance. I am pretty sure TS only supports it for compatibility reasons. While libraries since VueJS have adopted it as a practice, that doesn’t make it a good TypeScript practice, and those libraries weren’t designed with TypeScript in mind, even though VueJS 3 is now on TypeScript, and have always claimed that TypeScript is supported as a first party. But I digress 😃

https://ilikekillnerds.com/2019/08/default-exports-bad https://basarat.gitbook.io/typescript/main-1/defaultisbad https://medium.com/@rajeshnaroth/avoid-es6-default-exports-a24142978a7a

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mistake with the function add () cakephp 1.3.8 - Stack Overflow
Probably you have a mistake in your models and associations. However you can solve this problem by using loadModel before calling find on ......
Read more >
FLTK 1.3.8: Common Dialogs classes and functions
FLTK calls Fl::error() to output a normal error message. The default version on Windows displays the error message in a MessageBox window. The...
Read more >
utest (1.3.8) - Haxelib
Forces a failure. msg An optional error message. If not passed a default one will be used. pos Code position where the Assert...
Read more >
Chapter 1 The R environment | Introduction to Spatial Data ...
Executing the function is known as a function call. The function accepts zero or ... Since we don't have an object named a...
Read more >
error on very end of the checkout process - Call ... - Zen Cart Support
Fatal error: Call to undefined function zen_catalog_href_link() in ... Call to undefined function zen_catal. how do you upgrade from 1.3.8 to 1.3.9h ?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found