mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
fix(hooks): add type remove ts error (#4055)
This commit is contained in:
@@ -39,7 +39,7 @@ function translate(path, option, current) {
|
||||
}
|
||||
|
||||
export const useLocale = () => {
|
||||
const vm = getCurrentInstance()
|
||||
const vm = getCurrentInstance()!
|
||||
const props = vm.props as {
|
||||
locale: Language
|
||||
}
|
||||
@@ -60,7 +60,7 @@ export const useLocale = () => {
|
||||
locale,
|
||||
lang,
|
||||
t,
|
||||
}
|
||||
} as LocaleContext
|
||||
|
||||
// this could be broken if someone tries to do following:
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { kebabCase } from '@element-plus/utils/util'
|
||||
|
||||
const useMigrating = function () {
|
||||
onMounted(() => {
|
||||
const instance = getCurrentInstance()
|
||||
const instance = getCurrentInstance()!
|
||||
if (process.env.NODE_ENV === 'production') return
|
||||
if (!instance.vnode) return
|
||||
const { props = {} } = getMigratingConfig()
|
||||
@@ -16,7 +16,7 @@ const useMigrating = function () {
|
||||
if (props[propName]) {
|
||||
debugWarn(
|
||||
'Element Migrating',
|
||||
`[${instance.proxy.$options.name}][Attribute]: ${props[propName]}`
|
||||
`[${instance.proxy?.$options.name}][Attribute]: ${props[propName]}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ export const useModelToggle = ({
|
||||
onShow,
|
||||
onHide,
|
||||
}: ModelToggleParams) => {
|
||||
const { appContext, props, proxy, emit } = getCurrentInstance()
|
||||
const { appContext, props, proxy, emit } = getCurrentInstance()!
|
||||
|
||||
const hasUpdateHandler = computed(() =>
|
||||
isFunction(props['onUpdate:modelValue'])
|
||||
@@ -120,7 +120,7 @@ export const useModelToggle = ({
|
||||
}
|
||||
}
|
||||
|
||||
watch(() => props.modelValue, onChange)
|
||||
watch(() => props.modelValue, onChange as any)
|
||||
|
||||
if (
|
||||
shouldHideWhenRouteChanges &&
|
||||
|
||||
@@ -21,7 +21,7 @@ export const useTargetEvents = (
|
||||
onHide: Handler,
|
||||
onToggle: Handler
|
||||
) => {
|
||||
const { props } = getCurrentInstance()
|
||||
const { props } = getCurrentInstance()!
|
||||
|
||||
let triggerFocused = false
|
||||
|
||||
@@ -67,7 +67,7 @@ export const useTargetEvents = (
|
||||
|
||||
const mapEvents = (t: TriggerType) => {
|
||||
const events = {} as PopperEvents
|
||||
triggerEventsMap[t].forEach((event) => {
|
||||
triggerEventsMap[t]?.forEach((event) => {
|
||||
events[event] = popperEventsHandler
|
||||
})
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ export default (contentRenderer: () => VNode, appendToBody: Ref<boolean>) => {
|
||||
}
|
||||
}
|
||||
|
||||
let $el: HTMLElement = null
|
||||
let $el: HTMLElement | null = null
|
||||
|
||||
const showTeleport = () => {
|
||||
isTeleportVisible.value = true
|
||||
|
||||
Reference in New Issue
Block a user