shakee93 / vue-toasted

🖖 Responsive Touch Compatible Toast plugin for VueJS 2+
https://shakee93.github.io/vue-toasted/
MIT License
2.21k stars 194 forks source link

TypeScript returns a type error about ToastOptions.icon #132

Open sr-eric-park opened 5 years ago

sr-eric-park commented 5 years ago

Type Script returns a type error in following codes:

const toast = Vue.toasted.error(msg, {
    ...
    icon: 'mdi mdi-alert'
    ...
});

Error message: Types of property 'icon' are incompatible.

It seems that definitions need to be changed as below:

(-) icon?: (ToastIcon: HTMLElement) => HTMLElement | string | { name: string, after: boolean }, 
(+) icon?: ((ToastIcon: HTMLElement) => HTMLElement) | string | { name: string, after: boolean }, 

Please check changes of the commit a03cc406b1a75acbcb14c3ee0ed9d3da25c68a0a

Thanks

shtouff commented 5 years ago

Thanks @shakee93 for your time. Code is already OK in the repo, but not in the current release (1.1.27). When do you plan to push a new release ?

CLFPosthumus commented 4 years ago

Any news regarding this issue?

OssiPesonen commented 4 years ago

I happen to experience the same issue. Usage:

 Vue.toasted.success(response, { icon: 'times-circle' })

TypeScript error:

Argument of type '{ icon: string; }' is not assignable to parameter of type 'ToastOptions'.
Types of property 'icon' are incompatible.
Type 'string' is not assignable to type '((ToastIcon: HTMLElement) => string | HTMLElement | { name: string; after: boolean; }) | undefined'.

Using the fix mentioned above you can get rid of this issue.

ptomaszewski commented 4 years ago

@shakee93 Can you release changes ?

rcheung9 commented 4 years ago

Will someone please merge the PR? Is the author still active?

SachsKaylee commented 4 years ago

We've gone ahead and just installed the git repo directly for the meantime. (The compiled code is included in the GitHub repo.)

npm i git+https://github.com/shakee93/vue-toasted.git