mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Fix typing of refs
This commit is contained in:
@@ -61,10 +61,10 @@ function callHandlers(event: KeyboardEvent) {
|
||||
export default function useShortcut(
|
||||
shortcuts: string | string[],
|
||||
handler: ShortcutHandler,
|
||||
reference: Ref<HTMLElement | null> | Ref<Vue | null> = ref(document.body)
|
||||
reference: Ref<HTMLElement | undefined> | Ref<Vue | undefined> = ref(document.body)
|
||||
) {
|
||||
const callback: ShortcutHandler = (event) => {
|
||||
if (reference.value === null) return;
|
||||
if (!reference.value) return;
|
||||
const ref = reference.value instanceof HTMLElement ? reference.value : (reference.value.$el as HTMLElement);
|
||||
|
||||
if (
|
||||
|
||||
@@ -212,7 +212,7 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
const table = ref<Vue | null>(null);
|
||||
const table = ref<Vue>();
|
||||
const mainElement = inject('main-element', ref<Element | null>(null));
|
||||
|
||||
const _selection = useSync(props, 'selection', emit);
|
||||
|
||||
@@ -225,7 +225,7 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const form = ref(null);
|
||||
const form = ref<HTMLElement>();
|
||||
const userStore = useUserStore();
|
||||
|
||||
const { collection, primaryKey } = toRefs(props);
|
||||
|
||||
@@ -232,7 +232,7 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const form = ref<HTMLElement | null>(null);
|
||||
const form = ref<HTMLElement>();
|
||||
const { primaryKey } = toRefs(props);
|
||||
const { breadcrumb } = useBreadcrumb();
|
||||
const fieldsStore = useFieldsStore();
|
||||
|
||||
@@ -209,7 +209,7 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const form = ref<HTMLElement | null>(null);
|
||||
const form = ref<HTMLElement>();
|
||||
const fieldsStore = useFieldsStore();
|
||||
const userStore = useUserStore();
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
const textarea = ref<HTMLElement | null>(null);
|
||||
const textarea = ref<HTMLElement>();
|
||||
useShortcut('meta+enter', postComment, textarea);
|
||||
const newCommentContent = ref<string | null>(null);
|
||||
const saving = ref(false);
|
||||
|
||||
Reference in New Issue
Block a user