rlemaigre / vue3-promise-dialog

Dialogs meet promises in Vue 3 !
MIT License
69 stars 14 forks source link

Cannot find name '$close' vs-code #3

Closed lomonoshka closed 2 years ago

lomonoshka commented 2 years ago

Everything works great, but vs-code tells me that it can't find function $close. From where should I find it's declaration? Or maybe there is some workaround to just hide the error?

rlemaigre commented 2 years ago

Hello, it's declared here. When you install the plugin, it creates that global function and makes it available in all components. I'm not sure that VSCode can pick that up :-/

rlemaigre commented 2 years ago

Actually $close could be a plain JS function rather than a member function of components introduced by a plugin...since you have to pass this anyway...I don't know why I did it this way. I must look into this.

smitt04 commented 2 years ago

It would be nice as a function that could be imported from the library, but something like this will get you by if placed in a .d.ts file

declare module "@vue/runtime-core" {
  interface ComponentCustomProperties {
    $close: (comp?: Component, fallback?: any) => void;
  }
}
rlemaigre commented 2 years ago

$close has been deprecated, please use closeDialog now, see docs