Typescript: Cannot invoke an expression whose type lacks a call signature. Type 'typeof Swal' has no compatible call signatures
See original GitHub issueCurrent behavior
I’m using sweetalert2 with Angular and have this error when I try to compile something like swal("Some text")
on Angular 7.2.9:
error TS2349: Cannot invoke an expression whose type lacks a call signature.
Type 'typeof Swal' has no compatible call signatures.
before in Angular 6.0.3 it was working right.
I’m importing it like this:
import swal from "sweetalert2";
Expected behavior
It should compile.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Cannot invoke an expression whose type lacks a call ...
Type 'typeof import("sweetalert2")' has no compatible call signatures." this error while using SWAL in angular. My package-cli.json looks like.
Read more >This expression is not callable. Type 'X' no call signatures
The "This expression is not callable. Type 'X' has no call signatures" TypeScript error occurs when we try to call a type that...
Read more >typescript cannot invoke an expression whose type lacks a ...
"cannot invoke an expression that lacks a call signature" The problem is that the default value [] is inferred by the compiler to...
Read more >Error: Cannot Invoke An Expression Whose Type Lacks A Call ...
TypeScript Cannot Invoke an Expression whose Type Lacks a Call Signature. "Type 'blah' has no compatible call signatures". Parameter 'value' implicitly has ......
Read more >TypeScript Cannot Invoke an Expression ... - Matt Ferderer
This resulted in a warning "Cannot invoke an expression whose type lacks a call signature". "Type 'blah' has no compatible call signatures".
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @francovp the API to call swal changed recently in version 8.x. You now need to use
Swal.fire()
. If you are using latest version, then can you try with that?Never upgrade dependencies to new major versions without checking the release notes 😃
https://github.com/sweetalert2/sweetalert2/releases/v8.0.0