GitHub

Original file line numberDiff line numberDiff line change

@@ -2,7 +2,7 @@

22

import type { RadioGroupRootProps, RadioGroupRootEmits } from 'reka-ui'

33

import type { AppConfig } from '@nuxt/schema'

44

import theme from '#build/ui/radio-group'

5-

import type { AcceptableValue, GetItemKeys, GetModelValue } from '../types/utils'

5+

import type { AcceptableValue, GetItemKeys, GetModelValue, GetModelValueEmits } from '../types/utils'

66

import type { ComponentConfig } from '../types/tv'

77
88

type RadioGroup = ComponentConfig<typeof theme, AppConfig, 'radioGroup'>

@@ -71,9 +71,9 @@ export interface RadioGroupProps<T extends RadioGroupItem[] = RadioGroupItem[],

7171

ui?: RadioGroup['slots']

7272

}

7373
74-

export type RadioGroupEmits = RadioGroupRootEmits & {

74+

export type RadioGroupEmits<T extends RadioGroupItem[] = RadioGroupItem[], VK extends GetItemKeys<T> = 'value'> = Omit<RadioGroupRootEmits, 'update:modelValue'> & {

7575

change: [event: Event]

76-

}

76+

} & GetModelValueEmits<T, VK, false>

7777
7878

type NormalizeItem<T extends RadioGroupItem> = Exclude<T & { id: string }, RadioGroupValue>

7979

@@ -101,7 +101,7 @@ const props = withDefaults(defineProps<RadioGroupProps<T, VK>>(), {

101101

descriptionKey: 'description',

102102

orientation: 'vertical'

103103

})

104-

const emits = defineEmits<RadioGroupEmits>()

104+

const emits = defineEmits<RadioGroupEmits<T, VK>>()

105105

const slots = defineSlots<RadioGroupSlots<T>>()

106106
107107

const appConfig = useAppConfig() as RadioGroup['AppConfig']

Read the original on github.com ↗