fix type issue

This commit is contained in:
hjlarry 2026-01-13 22:18:54 +08:00
parent fad81ab85e
commit 1845938e70
2 changed files with 21 additions and 6 deletions

View File

@ -11,6 +11,7 @@ import type {
} from '../../types'
import type {
CollaborationState,
CollaborationUpdate,
CursorPosition,
NodePanelPresenceMap,
NodePanelPresenceUser,
@ -815,13 +816,14 @@ export class CollaborationManager {
})
}
private setupSocketEventListeners(socket: any): void {
socket.on('collaboration_update', (update: any) => {
private setupSocketEventListeners(socket: Socket): void {
socket.on('collaboration_update', (update: CollaborationUpdate) => {
if (update.type === 'mouse_move') {
// Update cursor state for this user
const data = update.data as { x: number; y: number }
this.cursors[update.userId] = {
x: update.data.x,
y: update.data.y,
x: data.x,
y: data.y,
userId: update.userId,
timestamp: update.timestamp,
}

View File

@ -49,9 +49,22 @@ export type GraphSyncData = {
edges: Edge[]
}
export type CollaborationEventType
= | 'mouse_move'
| 'vars_and_features_update'
| 'sync_request'
| 'app_state_update'
| 'app_meta_update'
| 'mcp_server_update'
| 'workflow_update'
| 'comments_update'
| 'node_panel_presence'
| 'app_publish_update'
| 'graph_resync_request'
export type CollaborationUpdate = {
type: 'mouse_move' | 'vars_and_features_update' | 'sync_request' | 'app_state_update' | 'app_meta_update' | 'mcp_server_update' | 'workflow_update' | 'comments_update' | 'node_panel_presence' | 'app_publish_update'
type: CollaborationEventType
userId: string
data: any
data: Record<string, unknown>
timestamp: number
}