Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'options' does not exist in type 'VueSocketOptions',but it works #300

Open
kkstun opened this issue Jan 18, 2021 · 1 comment
Open

'options' does not exist in type 'VueSocketOptions',but it works #300

kkstun opened this issue Jan 18, 2021 · 1 comment

Comments

@kkstun
Copy link

kkstun commented Jan 18, 2021

ERROR in E:/works-web/ws1/src/main.ts(21,3):
21:3 Argument of type '{ debug: true; connection: string; vuex: { store: Store<{}>; actionPrefix: string; mutationPre
fix: string; }; options: { path: string; transports: string[]; }; }' is not assignable to parameter of type 'VueSocke
tOptions'.
Object literal may only specify known properties, and 'options' does not exist in type 'VueSocketOptions'.
19 | mutationPrefix: 'SOCKET_'
20 | },

21 | options: { path: '/tushu/', transports: ['websocket'] } // Optional options
| ^
22 | }))
23 |
24 | new Vue({
Version: typescript 3.9.7

`Vue.use(new VueSocketIO({
debug: true,
connection: 'http://192.168.9.17:1234',
vuex: {
store,
actionPrefix: 'SOCKET_',
mutationPrefix: 'SOCKET_'
},
options: { path: '/tushu/', transports: ['websocket'] } // Optional options
}))

new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')`

it works!but why

@lyutian
Copy link

lyutian commented Feb 24, 2022

The npm package is not up to date.
There's no options definition in VueSocketOptions, so, the type check will report error.
Need these code in vue-socketio.js/index.d.ts:

Vue-Socket.io/index.d.ts

Lines 55 to 57 in 61614c8

options?:{
path?: string;
}

    options?: {
        path?: string,
        transports?: Array<string>
    }

lyutian added a commit to lyutian/Vue-Socket.io that referenced this issue Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants