Skip to content

How to get the EmitsType of components in TypeScript ? #6116

Discussion options

You must be logged in to vote

Extracting a generic argument in TypeScript typically looks like this (I haven't tested):

import type { DefineComponent } from 'vue'

export type ExtractEmits<T> = T extends DefineComponent<any, any, any, any, any, any, any, infer U> ? U : unknown

Perhaps #2179 can inspire you, too.

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@zz541843
Comment options

Answer selected by zz541843
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants