-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot use 'new' with an expression whose type lacks a call or construct signature. #98
Comments
Thanks for the report. Is this using version Some folks using React seem to have trouble importing. You can check out #53 and #79 for more info and workarounds. We also just updated the |
You might also want to try |
Thanks @bobby-brennan !! Yes it's version 3.6.3. So, I'll take a look at those workarounds and try 3.6.2 as well. I did try |
Just to update you, I tried 3.6.2 and got the same errors. I haven't tried the workarounds yet |
Same here, still couldn't get it to work both 3.6.2 and 3.6.3. Tried: Then:
I'm getting these errors:
I'm trying to use this with Angular and Ionic 4. |
I just tired something similar to @ninoguba with |
Also tried the workaround #53 with using It complied but got a runtime error of |
@FaganSC are you using TypeScript, or are you using JavaScript? |
@benji7425 Typescript. It's a SharePoint Framework project I'm working on. |
And is it a runtime error or compile time error you're seeing? Can you post the generated java script if you can build? |
Even with the latest 3.7.0 version, I'm still getting this compile error:
When using this to import:
Too bad, being able to use this would have been great but moving on for now... |
Hi, would love to get this working with Angular 7, cant get the import to work correctly. (tried using version 3.7.0 with all the above suggestions) |
I'm also wanting to use this rss-parser, but i'm getting the same errors as @ninoguba using Angular/Ionic4 |
You should be able to use Make sure you have |
I have set
When I change it to
Versions I tried: 3.5.4, 3.6.3 and 3.7.0 Do you have an idea? I can setup a git repo so you can reproduce if you want. |
If you can provide a git repo to reproduce I would be happy to take a look @tofra |
Here you go: https://github.com/tofra/angular-rss-parser |
I've taken a look at your demo @tofra, I believe this issue is related to Angular's module resolution rather than anything to do with this repository. I don't have experience with Angular, so can't help you solve these issues, but your Angular config seems unable to resolve some core node modules. Specifically "http", "https" and "timers". This can be demonstrated by trying to import "https" yourself. Remove all references to "rss-parser" from your project so that it compiles fine. Then add To further validate that the current rss-parser typings are working fine with your project, you can compile directly with typescript and check the outputted javascript. Using The issue is with your angular config being unable to resolve various node modules, which this library relies upon. |
yes, you are correct, the "can't resolve issue" can be fixed using #109 (comment) But still I have the issue with I haven't found a solution for it yet. |
Let's continue this discussion in your project so as not to pollute this issue. We can update here if we find the cause. |
Update: looks like this is caused by using 'esModuleInterop' with your TypeScript. As far as I can tell this project implements CommonJS module standards which violate new ECMAScript module standards. 'esModuleInterop' instructs TypeScript to error if trying to implement a module in a non-ES-valid way. There is also #96 requesting support for ES modules. |
HI all,
|
I'll assume the above is the right solution. Please reopen if that doesn't work for anyone. |
Trying to use this NPM Package in a SharePoint ReactJS Framework project and when I try to use it, I get "Cannot use 'new' with an expression whose type lacks a call or construct signature."
I'm trying the NodeJS example to start with and it's erroring on the following line:
var parser = require('rss-parser');
let parser = new Parser();
I have also tried import { Parser } from 'rss-parser'; in the project and it finds the module but get this as well:
Module '"../../../../../spfx/node_modules/rss-parser"' has no exported member 'Parser'.
Any Thoughts?
The text was updated successfully, but these errors were encountered: