refactor: fix broken Vue component custom properties (#9351)

This commit is contained in:
Kagami Sascha Rosylight 2022-12-19 10:40:57 +09:00 committed by GitHub
parent 8f389b6a73
commit 411b088418
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 26 deletions

View File

@ -1,7 +1,16 @@
/// <reference types="vue/macros-global" /> /// <reference types="vue/macros-global" />
declare module '*.vue' { import type { $i } from '@/account';
import type { DefineComponent } from 'vue'; import type { defaultStore } from '@/store';
const component: DefineComponent<{}, {}, any>; import type { instance } from '@/instance';
export default component; import type { i18n } from '@/i18n';
declare module 'vue' {
interface ComponentCustomProperties {
$i: typeof $i;
$store: typeof defaultStore;
$instance: typeof instance;
$t: typeof i18n['t'];
$ts: typeof i18n['ts'];
}
} }

View File

@ -3,11 +3,3 @@ import { locale } from '@/config';
import { I18n } from '@/scripts/i18n'; import { I18n } from '@/scripts/i18n';
export const i18n = markRaw(new I18n(locale)); export const i18n = markRaw(new I18n(locale));
// このファイルに書きたくないけどここに書かないと何故かVeturが認識しない
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$t: typeof i18n['t'];
$ts: typeof i18n['locale'];
}
}

View File

@ -43,10 +43,3 @@ export const emojiTags = computed(() => {
} }
return Array.from(tags); return Array.from(tags);
}); });
// このファイルに書きたくないけどここに書かないと何故かVeturが認識しない
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$instance: typeof instance;
}
}

View File

@ -381,10 +381,3 @@ export class ColdDeviceStorage {
}; };
} }
} }
// このファイルに書きたくないけどここに書かないと何故かVeturが認識しない
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$store: typeof defaultStore;
}
}