File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
packages/core/useCurrentElement Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 11// eslint-disable-next-line no-restricted-imports
22import { getCurrentInstance , onMounted , onUpdated } from 'vue-demi'
3- import { computedWithControl } from '@vueuse/shared'
3+ import { type IsAny , computedWithControl } from '@vueuse/shared'
44import type { MaybeElement , MaybeElementRef , VueInstance } from '../unrefElement'
55import { unrefElement } from '../unrefElement'
66
77export function useCurrentElement <
88 T extends MaybeElement = MaybeElement ,
99 R extends VueInstance = VueInstance ,
10+ E extends MaybeElement = MaybeElement extends T ? IsAny < R [ '$el' ] > extends false ? R [ '$el' ] : T : T ,
1011> (
1112 rootComponent ?: MaybeElementRef < R > ,
1213) {
1314 const vm = getCurrentInstance ( ) !
1415 const currentElement = computedWithControl (
1516 ( ) => null ,
16- ( ) => ( rootComponent ? unrefElement ( rootComponent ) : vm . proxy ! . $el ) as T ,
17+ ( ) => ( rootComponent ? unrefElement ( rootComponent ) : vm . proxy ! . $el ) as E ,
1718 )
1819
1920 onUpdated ( currentElement . trigger )
You can’t perform that action at this time.
0 commit comments