marcelodolza / iziToast

Elegant, responsive, flexible and lightweight notification plugin with no dependencies.

Home Page:http://izitoast.marcelodolza.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error only while compiling: "Argument of type ... is not assignable"

diegograziano opened this issue · comments

Hi, I´am having this issue when I try to compile my project. So, I have to comment the method to continue compiling, but the iziToast works perfectly fine! Any idea? The problem are in the buttons functions, because if I remove them, everything is ok.

iziToast.error({ timeout: 20000, close: true, backgroundColor: '', overlay: true, id: 'borrar_usuario', zindex: 9999, title: '¿Estás seguro que querés eliminar a este usuario?', message: 'Esta acción es irreversible', position: 'center', buttons: [ ['<button><b>Si</b></button>', (instance, toast) => { this .usuariosService.eliminarUsuario(documentId).then(() => { console.log('Usuario eliminado!'); }, (error) => { console.error(error); }), instance.hide({ transitionOut: 'fadeOut' }, toast, 'button'); } // (instance, toast) => ], ['<button>No</button>', (instance, toast) => instance.hide({ transitionOut: 'fadeOut' }, toast, 'button')], ] });

I am combining the result (if user click "yes) to delete an entry from a db. It works perfectly, but error still there and bring me problems when compile (serve or deploy). I am newbie in TS, please help!

TS Lint error in VS Code:

Types of property 'buttons' are incompatible.
Type '[string, (instance: IziToast, toast: HTMLDivElement) => void][]' is not assignable to type '[string, (instance: IziToast, toast: HTMLDivElement, button: HTMLButtonElement, event: MouseEvent...'.
Type '[string, (instance: IziToast, toast: HTMLDivElement) => void]' is not assignable to type '[string, (instance: IziToast, toast: HTMLDivElement, button: HTMLButtonElement, event: MouseEvent...'.
Property '2' is missing in type '[string, (instance: IziToast, toast: HTMLDivElement) => void]'.

Thanks in advance.