mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-21 22:45:36 +02:00
refactor(frontend): フロントエンドの型エラー解消 (#16694)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
import { throttle } from 'throttle-debounce';
|
||||
import type { Directive } from 'vue';
|
||||
import type { Awaitable } from '@/types/misc.js';
|
||||
|
||||
interface HTMLElementWithObserver extends HTMLElement {
|
||||
_observer_?: IntersectionObserver;
|
||||
@@ -31,4 +32,4 @@ export const appearDirective = {
|
||||
unmounted(src) {
|
||||
if (src._observer_) src._observer_.disconnect();
|
||||
},
|
||||
} as Directive<HTMLElementWithObserver, () => void>;
|
||||
} as Directive<HTMLElementWithObserver, (() => Awaitable<void>) | null | undefined>;
|
||||
|
||||
@@ -15,7 +15,7 @@ const start = isTouchUsing ? 'touchstart' : 'mouseenter';
|
||||
const end = isTouchUsing ? 'touchend' : 'mouseleave';
|
||||
|
||||
type TooltipDirectiveState = {
|
||||
text: string;
|
||||
text: string | null | undefined;
|
||||
_close: null | (() => void);
|
||||
showTimer: number | null;
|
||||
hideTimer: number | null;
|
||||
@@ -53,6 +53,7 @@ export const tooltipDirective = {
|
||||
|
||||
if (binding.arg === 'dialog') {
|
||||
el.addEventListener('click', (ev) => {
|
||||
if (binding.value == null) return;
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
alert({
|
||||
@@ -128,4 +129,4 @@ export const tooltipDirective = {
|
||||
if (self.checkTimer) window.clearTimeout(self.checkTimer);
|
||||
self.close();
|
||||
},
|
||||
} as Directive<TooltipDirectiveElement, string, TooltipDirectiveModifiers, TooltipDirectiveArg>;
|
||||
} as Directive<TooltipDirectiveElement, string | null | undefined, TooltipDirectiveModifiers, TooltipDirectiveArg>;
|
||||
|
||||
@@ -131,4 +131,4 @@ export const userPreviewDirective = {
|
||||
if (self == null) return;
|
||||
self.preview.detach();
|
||||
},
|
||||
} as Directive<UserPreviewDirectiveElement, string | Misskey.entities.UserDetailed>;
|
||||
} as Directive<UserPreviewDirectiveElement, string | Misskey.entities.UserDetailed | null | undefined>;
|
||||
|
||||
Reference in New Issue
Block a user