Description
Version
2.4.2
Reproduction link
https://github.com/johnlindquist/vue-typescript-simple
Steps to reproduce
Create a new Vuejs project with Typescript and add a plugin that passes 3 arguments into the use command.
-
download https://github.com/johnlindquist/vue-typescript-simple
-
install vue-native-websocket
npm install vue-native-websocket --save
-
Add the following lines to src/main.ts:
import VueNativeSock from 'vue-native-websocket'
Vue.use(VueNativeSock, 'ws://localhost:9090', { store: store, format: 'json' })
What is expected?
That the vue.d.ts definition for the use function reflects the actual functionality.
What is actually happening?
The vue.d.ts definition only allows for the Plugin object or function and an options object.
The actual function defined in vue/use.js takes in the Plugin object or function and any number of optional parameters, it doesn't actually ask for an options object, that's all up to the Plugin.
My suggestion would be to make the following change:
The vue.d.ts line 101 should be:
static use<T>(plugin: PluginObject<T> | PluginFunction<T>, ...additionalParams: any[]): void;
and not:
static use<T>(plugin: PluginObject<T> | PluginFunction<T>, options?: T): void;
You could have both options available, but the way that the function is written in use.js, the definition I've written above should be more correct.