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] Swal namespace isn't recognized when importing from 'sweetalert2/src/sweetalert2.js'

See original GitHub issue

Steps to reproduce

  1. clone https://github.com/sweetalert2/sweetalert2-parcel-demo
  2. open app.ts

Current behavior

image

Expected behavior

The same as when importing Swal 'sweetalert2':

image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
limontecommented, Apr 8, 2021

@mlbonniec please create another issue with the simple repo to reproduce the issue.

0reactions
mlbonnieccommented, Apr 8, 2021

Hi, I’ve the same issue. I want as well, import SweetAlert JS without CSS.
I red your issue on VSCode repository https://github.com/microsoft/vscode/issues/107061, but it didn’t resolve mine. 😕

https://user-images.githubusercontent.com/29955402/114052670-8808fb00-988e-11eb-92c9-3ee1ee58ec77.mov

Yet, I’ve a tsconfig.json like this

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "lib": ["es2017", "es7", "es6", "dom"],
    "declaration": true,
    "outDir": "dist",
    "strict": true,
    "esModuleInterop": true,
		"experimentalDecorators": true,
  },
  "exclude": [
    "dist"
  ],
  "include": [
    "./node_modules/sweetalert2/sweetalert2.d.ts"
  ]
}

Do you know how to fix?

Here are my VSCode and others, versions.

Capture d’écran 2021-04-08 à 17 20 38

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Using SweetAlert2 with TypeScript, could not find a ...
Try removing the declare module block entirely in your copied file. Then, use declare namespace Swal , and it'll work. We should be...
Read more >
Types aren't recognized until I open them in another tab - GitHub
[TypeScript] Swal namespace isn't recognized when importing from 'sweetalert2/src/sweetalert2.js' sweetalert2/sweetalert2#2056.
Read more >
sweetalert - npm
A beautiful replacement for JavaScript's "alert". Latest version: 2.1.2, last published: 4 years ago. Start using sweetalert in your project ...
Read more >
Docs - SweetAlert
The modal's text. It can either be added as a configuration under the key text (as in the example below), or passed as...
Read more >
SweetAlert2 - a beautiful, responsive, customizable and ...
A beautiful, responsive, customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes.
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