From 683cc88c54c4416bd29ed903b0a521e4cb591d69 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Fri, 9 Oct 2020 19:51:43 +0800 Subject: [PATCH] types: improve ref typing --- src/checkbox/Checker.tsx | 4 ++-- src/image/index.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/checkbox/Checker.tsx b/src/checkbox/Checker.tsx index 1a8fce040..51151b051 100644 --- a/src/checkbox/Checker.tsx +++ b/src/checkbox/Checker.tsx @@ -31,7 +31,7 @@ export default defineComponent({ emits: ['click', 'toggle'], setup(props, { emit, slots }) { - const iconRef = ref(); + const iconRef = ref(); const getParentProp = (name: string) => { if (props.parent) { @@ -60,7 +60,7 @@ export default defineComponent({ const onClick = (event: MouseEvent) => { const { target } = event; const icon = iconRef.value; - const iconClicked = icon === target || icon.contains(target); + const iconClicked = icon === target || icon!.contains(target as Node); if (!disabled.value && (iconClicked || !props.labelDisabled)) { emit('toggle'); diff --git a/src/image/index.tsx b/src/image/index.tsx index 84dacd340..2abb6b229 100644 --- a/src/image/index.tsx +++ b/src/image/index.tsx @@ -39,7 +39,7 @@ export default createComponent({ setup(props, { emit, slots }) { const error = ref(false); const loading = ref(true); - const imageRef = ref(); + const imageRef = ref(); const style = computed(() => { const style: CSSProperties = {};