Skip to content

Commit a844f93

Browse files
committed
fix: filter events from props
1 parent 86a33a2 commit a844f93

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/parser.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { hash } from 'ohash'
99
import type { ModuleOptions } from './options'
1010
import type { NuxtComponentMeta } from './types'
1111
import { defu } from 'defu'
12+
import { camelCase } from 'scule'
1213

1314
export type ComponentMetaParserOptions = Omit<ModuleOptions, 'components' | 'metaSources'> & {
1415
components: Component[]
@@ -206,8 +207,10 @@ export function useComponentMetaParser (
206207
component.meta.slots = metaFields.slots ? slots : []
207208
component.meta.events = metaFields.events ? events : []
208209
component.meta.exposed = metaFields.exposed ? exposed : []
210+
211+
const eventProps = new Set<string>(events.map(event => camelCase(`on_${event.name}`)))
209212
component.meta.props = (metaFields.props ? props : [])
210-
.filter((prop: any) => !prop.global)
213+
.filter((prop: any) => !prop.global && !eventProps.has(prop.name as string))
211214
.sort((a: { type: string, required: boolean }, b: { type: string, required: boolean }) => {
212215
// sort required properties first
213216
if (!a.required && b.required) {

0 commit comments

Comments
 (0)