vue-toasted icon indicating copy to clipboard operation
vue-toasted copied to clipboard

TypeScript returns a type error about ToastOptions.icon

Open sr-eric-park opened this issue 5 years ago • 6 comments

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

sr-eric-park avatar May 30 '19 02:05 sr-eric-park

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 ?

shtouff avatar Aug 12 '19 08:08 shtouff

Any news regarding this issue?

CLFPosthumus avatar Oct 20 '19 11:10 CLFPosthumus

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.

OssiPesonen avatar Nov 14 '19 05:11 OssiPesonen

@shakee93 Can you release changes ?

ptomaszewski avatar Dec 11 '19 15:12 ptomaszewski

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

rcheung9 avatar Jan 05 '20 02:01 rcheung9

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

SachsKaylee avatar Feb 04 '20 08:02 SachsKaylee