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.

Typescript: Cannot invoke an expression whose type lacks a call signature. Type 'typeof Swal' has no compatible call signatures

See original GitHub issue

Current 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:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
gvernicommented, Mar 14, 2019

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?

3reactions
limontecommented, Mar 14, 2019

Never upgrade dependencies to new major versions without checking the release notes 😃

https://github.com/sweetalert2/sweetalert2/releases/v8.0.0

Read more comments on GitHub >

github_iconTop 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 >

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