Sweetalert2: Property 'mixin' does not exist on type 'typeof swal'

Created on 25 May 2018  路  3Comments  路  Source: sweetalert2/sweetalert2

I'm working on Angular 6 Project, using vscode IDE.

"dependencies": { "sweetalert2": "^7.20.9" }


I have run npm i sweetalert2 and import swal from 'sweetalert2'; in my code.

When I tried to use swal.mixin({ .. }), I'm getting the mixin error:

Property 'mixin' does not exist on type 'typeof swal'

Do I missed out anything?

typescript inconvenience

Most helpful comment

No, the definition file does not contain this method yet.
It has to be updated, I'll try to have a look soon, but for the moment you can do this:

// @todo swal.mixin() is not in SweetAlert's .d.ts for now (see sweetalert2/sweetalert2/issues/1110)
(swal as any).mixin({ .. });

All 3 comments

No, the definition file does not contain this method yet.
It has to be updated, I'll try to have a look soon, but for the moment you can do this:

// @todo swal.mixin() is not in SweetAlert's .d.ts for now (see sweetalert2/sweetalert2/issues/1110)
(swal as any).mixin({ .. });

The "moment" is quite long ...

It might be quite simple work isn't it?

@darron1217 we are opened for your contributions :)

Was this page helpful?
0 / 5 - 0 ratings