ankurk91/vue-toast-notification

types: missing return type in `close()` and `clear()` for strict TS compilation

wtho opened this issue · 2 comments

wtho commented

I'm submitting a Bug Report

  • Vue.js version : 2.6.x
  • This package version : 0.5.3

Current behavior
TS does not compile with strict flag due to missing return types (imlicit any)

Expected behavior
The lib should provide sufficient types to enable strict compiling

Minimal reproduction of the problem with instructions
Will only set it up if you really require it

Solution

// toast.d.ts

  export interface ToastComponent extends ExtendedVue<any, any, any, any, any> {
-   close()
+   close(): void
  }

  export interface ToastApi {
    open(message: string): ToastComponent
  
    open(options: ToastOptions): ToastComponent
  
    success(message: string, options?: ToastOptions): ToastComponent
  
    error(message: string, options?: ToastOptions): ToastComponent
  
    info(message: string, options?: ToastOptions): ToastComponent
  
    warning(message: string, options?: ToastOptions): ToastComponent
  
    default(message: string, options?: ToastOptions): ToastComponent

-    clear()
+    clear(): void
  }

Thanks for this awesome package and adding types!
Cheers and happy coding!

Thanks for reporting.

i will update and republish

wtho commented

Thanks for your quick actioning!

Could you publish as well? Would be awesome!


Edit: saw it was just published - thanks a lot!