eolant / vuetify-toast-snackbar

Basic Vue toast service that uses Vuetify Snackbar component.
MIT License
128 stars 36 forks source link

Missing info, error, ... in TS declaration file #4

Closed Jnig closed 5 years ago

Jnig commented 5 years ago

Hi,

thanks for the great component! Since the last update I get the following error:

ERROR in /app/src/modules/validation/ScanList.vue 147:17 Property 'info' does not exist on type '(message: string, options?: VuetifyToastObject | undefined) => void'. 146 |

147 | this.$toast.info('Files were uploaded... please wait until processing has finished');

I looks like the declaration for the info, errror,... functions is missing in the added TS file.

Thanks!

eolant commented 5 years ago

@Jnig Hi, Thanks for submitting the issue. I can see the problem here, as these are dynamically created. Though it might be possible to write interface for default methods, I'm not sure about the best approach to write an interface for everything. If you have any ideas how to make TS happy, you're welcome to comment or create a pull request. The only solution that comes to mind is to write:

declare module 'vue/types/vue' {
  interface Vue {
    $toast: any
  }
}

Can you please try to modify index.d.ts in the package directory and check if this approach will solve your problem?

Jnig commented 5 years ago

thanks for the fix!! 👍

vasan057 commented 5 years ago

app.js:142552 [Vue warn]: Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option.

(found in )