mirror of
https://github.com/MetinSeylan/Vue-Socket.io.git
synced 2025-04-16 15:21:28 +02:00
add types definition
This commit is contained in:
parent
8988085bef
commit
847e567cc2
2 changed files with 32 additions and 0 deletions
31
index.d.ts
vendored
Normal file
31
index.d.ts
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
import SocketIOClient from "socket.io-client";
|
||||
import {
|
||||
DefaultComputed,
|
||||
DefaultData,
|
||||
DefaultMethods,
|
||||
DefaultProps,
|
||||
PropsDefinition,
|
||||
} from "vue/types/options";
|
||||
import { Vue } from "vue/types/vue";
|
||||
|
||||
interface socketHandler<T> {
|
||||
(this: T, ...args: any[]): SocketIOClient.Socket
|
||||
}
|
||||
|
||||
declare module 'vue/types/vue' {
|
||||
interface Vue {
|
||||
$socket: SocketIOClient.Socket
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'vue/types/options' {
|
||||
interface ComponentOptions<
|
||||
V extends Vue,
|
||||
Data=DefaultData<V>,
|
||||
Methods=DefaultMethods<V>,
|
||||
Computed=DefaultComputed,
|
||||
PropsDef=PropsDefinition<DefaultProps>,
|
||||
Props=DefaultProps> {
|
||||
sockets: {[key: string]: socketHandler<V>}
|
||||
}
|
||||
}
|
|
@ -38,6 +38,7 @@
|
|||
"@babel/preset-env": "^7.1.0",
|
||||
"babel-loader": "^8.0.4",
|
||||
"cross-env": "^5.2.0",
|
||||
"vue": "^2.6.10",
|
||||
"webpack": "^4.23.1",
|
||||
"webpack-cli": "^3.1.2"
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue