Skip to content

Commit

Permalink
fix(types): don't omit properties from forwarded DOM elements
Browse files Browse the repository at this point in the history
fixes #15930
  • Loading branch information
KaelWD committed Oct 21, 2022
1 parent 191de2e commit f164fbf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/vuetify/src/composables/forwardRefs.ts
Expand Up @@ -4,12 +4,12 @@ import type { UnionToIntersection } from '@/util'
const Refs = Symbol('Forwarded refs')

/** Omit properties starting with P */
type OmitPrefix<T, P extends string> = Omit<T, keyof T extends `${P}${any}` ? keyof T : never>
type OmitPrefix<T, P extends string> = [Extract<keyof T, `${P}${any}`>] extends [never] ? T : Omit<T, `${P}${any}`>

export function forwardRefs<T extends {}, U extends Ref<HTMLElement | Omit<ComponentPublicInstance, '$emit'> | undefined>[]> (
target: T,
...refs: U
): T & OmitPrefix<UnwrapRef<UnionToIntersection<U[number]>>, '$'> {
): T & UnionToIntersection<{ [K in keyof U]: OmitPrefix<NonNullable<UnwrapRef<U[K]>>, '$'> }[number]> {
(target as any)[Refs] = refs

return new Proxy(target, {
Expand Down

0 comments on commit f164fbf

Please sign in to comment.