[refactor] Improve type safety across Vue node widget system

- Create WidgetValue union type for all valid widget values
- Replace 'any' types with proper generic constraints in SimplifiedWidget
- Add runtime validation for widget values in useGraphNodeManager
- Update WidgetSelect to use constrained generics instead of any
- Fix type assertions with proper validation functions
- Ensure SafeWidgetData uses WidgetValue type consistently

This eliminates most 'any' usage while maintaining runtime safety through validation.
This commit is contained in:
bymyself
2025-07-05 02:31:42 -07:00
parent 71c3c727cf
commit 290906e7cc
5 changed files with 82 additions and 17 deletions

View File

@@ -25,13 +25,13 @@ import {
} from '@/utils/widgetPropFilter'
const props = defineProps<{
widget: SimplifiedWidget<any>
modelValue: any
widget: SimplifiedWidget<string | number | undefined>
modelValue: string | number | undefined
readonly?: boolean
}>()
const emit = defineEmits<{
'update:modelValue': [value: any]
'update:modelValue': [value: string | number | undefined]
}>()
// Use the composable for consistent widget value handling