1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-22 14:04:08 +02:00

refactor: make noImplicitAny true (#17083)

* wip

* Update emojis.emoji.vue

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Update manager.ts

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Update analytics.ts
This commit is contained in:
syuilo
2026-01-09 22:06:40 +09:00
committed by GitHub
parent 2a14025c29
commit 41592eafb3
233 changed files with 966 additions and 963 deletions

View File

@@ -85,6 +85,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { defineAsyncComponent, computed } from 'vue';
import { supported as webAuthnSupported, create as webAuthnCreate, parseCreationOptionsFromJSON } from '@github/webauthn-json/browser-ponyfill';
import * as Misskey from 'misskey-js';
import MkButton from '@/components/MkButton.vue';
import MkInfo from '@/components/MkInfo.vue';
import MkSwitch from '@/components/MkSwitch.vue';
@@ -156,7 +157,7 @@ function renewTOTP(): void {
});
}
async function unregisterKey(key) {
async function unregisterKey(key: NonNullable<Misskey.entities.MeDetailedOnly['securityKeysList']>[number]) {
const confirm = await os.confirm({
type: 'question',
title: i18n.ts._2fa.removeKey,
@@ -175,7 +176,7 @@ async function unregisterKey(key) {
os.success();
}
async function renameKey(key) {
async function renameKey(key: NonNullable<Misskey.entities.MeDetailedOnly['securityKeysList']>[number]) {
const name = await os.inputText({
title: i18n.ts.rename,
default: key.name,

View File

@@ -189,7 +189,7 @@ const onImportSuccess = () => {
});
};
const onError = (ev) => {
const onError = (ev: Error) => {
os.alert({
type: 'error',
text: ev.message,
@@ -232,7 +232,7 @@ const exportAntennas = () => {
misskeyApi('i/export-antennas', {}).then(onExportSuccess).catch(onError);
};
const importFollowing = async (ev) => {
const importFollowing = async (ev: PointerEvent) => {
const file = await selectFile({
anchorElement: ev.currentTarget ?? ev.target,
multiple: false,
@@ -243,7 +243,7 @@ const importFollowing = async (ev) => {
}).then(onImportSuccess).catch(onError);
};
const importUserLists = async (ev) => {
const importUserLists = async (ev: PointerEvent) => {
const file = await selectFile({
anchorElement: ev.currentTarget ?? ev.target,
multiple: false,
@@ -251,7 +251,7 @@ const importUserLists = async (ev) => {
misskeyApi('i/import-user-lists', { fileId: file.id }).then(onImportSuccess).catch(onError);
};
const importMuting = async (ev) => {
const importMuting = async (ev: PointerEvent) => {
const file = await selectFile({
anchorElement: ev.currentTarget ?? ev.target,
multiple: false,
@@ -259,7 +259,7 @@ const importMuting = async (ev) => {
misskeyApi('i/import-muting', { fileId: file.id }).then(onImportSuccess).catch(onError);
};
const importBlocking = async (ev) => {
const importBlocking = async (ev: PointerEvent) => {
const file = await selectFile({
anchorElement: ev.currentTarget ?? ev.target,
multiple: false,
@@ -267,7 +267,7 @@ const importBlocking = async (ev) => {
misskeyApi('i/import-blocking', { fileId: file.id }).then(onImportSuccess).catch(onError);
};
const importAntennas = async (ev) => {
const importAntennas = async (ev: PointerEvent) => {
const file = await selectFile({
anchorElement: ev.currentTarget ?? ev.target,
multiple: false,

View File

@@ -38,7 +38,7 @@ function refreshAllAccounts() {
// TODO
}
function showMenu(host: string, id: string, ev: MouseEvent) {
function showMenu(host: string, id: string, ev: PointerEvent) {
let menu: MenuItem[];
menu = [{
@@ -54,7 +54,7 @@ function showMenu(host: string, id: string, ev: MouseEvent) {
os.popupMenu(menu, ev.currentTarget ?? ev.target);
}
function addAccount(ev: MouseEvent) {
function addAccount(ev: PointerEvent) {
os.popupMenu([{
text: i18n.ts.existingAccount,
action: () => { addExistingAccount(); },

View File

@@ -37,7 +37,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #label>{{ i18n.ts.permission }}</template>
<template #suffix>{{ Object.keys(token.permission).length === 0 ? i18n.ts.none : Object.keys(token.permission).length }}</template>
<ul>
<li v-for="p in token.permission" :key="p">{{ i18n.ts._permissions[p] }}</li>
<li v-for="p in token.permission" :key="p">{{ (i18n.ts._permissions as any)[p] ?? p }}</li>
</ul>
</MkFolder>
</div>
@@ -68,7 +68,7 @@ const paginator = markRaw(new Paginator('i/apps', {
},
}));
function revoke(token) {
function revoke(token: Misskey.entities.IAppsResponse[number]) {
misskeyApi('i/revoke-token', { tokenId: token.id }).then(() => {
paginator.reload();
});

View File

@@ -113,7 +113,7 @@ watch(wallpaper, () => {
suggestReload();
});
function setWallpaper(ev: MouseEvent) {
function setWallpaper(ev: PointerEvent) {
selectFile({
anchorElement: ev.currentTarget ?? ev.target,
multiple: false,

View File

@@ -116,11 +116,11 @@ function genUsageBar(fsize: number): StyleValue {
};
}
function onClick(ev: MouseEvent, file) {
function onClick(ev: PointerEvent, file: Misskey.entities.DriveFile) {
os.popupMenu(getDriveFileMenu(file), (ev.currentTarget ?? ev.target ?? undefined) as HTMLElement | undefined);
}
function onContextMenu(ev: MouseEvent, file): void {
function onContextMenu(ev: PointerEvent, file: Misskey.entities.DriveFile): void {
os.contextMenu(getDriveFileMenu(file), ev);
}

View File

@@ -52,7 +52,7 @@ async function edit() {
});
}
function del(ev: MouseEvent) {
function del(ev: PointerEvent) {
os.popupMenu([{
text: i18n.ts.delete,
action: () => {

View File

@@ -52,7 +52,7 @@ async function edit() {
});
}
function del(ev: MouseEvent) {
function del(ev: PointerEvent) {
os.popupMenu([{
text: i18n.ts.delete,
action: () => {

View File

@@ -76,11 +76,11 @@ const $i = ensureSignin();
const emailAddress = ref($i.email ?? '');
const onChangeReceiveAnnouncementEmail = (v) => {
function onChangeReceiveAnnouncementEmail(v: boolean) {
misskeyApi('i/update', {
receiveAnnouncementEmail: v,
});
};
}
async function saveEmailAddress() {
const auth = await os.authenticateDialog();

View File

@@ -76,7 +76,7 @@ watch(emojis, () => {
emit('updateEmojis', emojis.value);
}, { deep: true });
function remove(reaction: string, ev: MouseEvent) {
function remove(reaction: string, ev: PointerEvent) {
os.popupMenu([{
text: i18n.ts.remove,
action: () => {
@@ -85,7 +85,7 @@ function remove(reaction: string, ev: MouseEvent) {
}], getHTMLElement(ev));
}
function pick(ev: MouseEvent) {
function pick(ev: PointerEvent) {
os.pickEmoji(getHTMLElement(ev), {
showPinned: false,
}).then(it => {
@@ -96,7 +96,7 @@ function pick(ev: MouseEvent) {
});
}
function getHTMLElement(ev: MouseEvent): HTMLElement {
function getHTMLElement(ev: PointerEvent): HTMLElement {
const target = ev.currentTarget ?? ev.target;
return target as HTMLElement;
}
@@ -124,7 +124,7 @@ function paste() {
});
}
function del(ev: MouseEvent) {
function del(ev: PointerEvent) {
os.popupMenu([{
text: i18n.ts.delete,
action: () => {

View File

@@ -226,12 +226,12 @@ function delPalette(id: string) {
}
}
function getHTMLElement(ev: MouseEvent): HTMLElement {
function getHTMLElement(ev: PointerEvent): HTMLElement {
const target = ev.currentTarget ?? ev.target;
return target as HTMLElement;
}
function previewPicker(ev: MouseEvent) {
function previewPicker(ev: PointerEvent) {
emojiPicker.show(getHTMLElement(ev));
}

View File

@@ -166,7 +166,7 @@ const menuDef = computed<SuperMenuDef[]>(() => [{
type: 'button',
icon: 'ti ti-settings-2',
text: i18n.ts.preferencesProfile,
action: async (ev: MouseEvent) => {
action: async (ev) => {
os.popupMenu(getPreferencesProfileMenu(), ev.currentTarget ?? ev.target);
},
}, {

View File

@@ -55,12 +55,12 @@ import {
const emojis = prefer.model('mutingEmojis');
function getHTMLElement(ev: MouseEvent): HTMLElement {
function getHTMLElement(ev: PointerEvent): HTMLElement {
const target = ev.currentTarget ?? ev.target;
return target as HTMLElement;
}
function add(ev: MouseEvent) {
function add(ev: PointerEvent) {
os.pickEmoji(getHTMLElement(ev), { showPinned: false }).then((emoji) => {
if (emoji) {
muteEmoji(emoji);
@@ -68,7 +68,7 @@ function add(ev: MouseEvent) {
});
}
function onEmojiClick(ev: MouseEvent, emoji: string) {
function onEmojiClick(ev: PointerEvent, emoji: string) {
const menuItems : MenuItem[] = [{
type: 'label',
text: emoji,

View File

@@ -173,6 +173,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref, computed, watch, markRaw } from 'vue';
import * as Misskey from 'misskey-js';
import XEmojiMute from './mute-block.emoji-mute.vue';
import XInstanceMute from './mute-block.instance-mute.vue';
import XWordMute from './mute-block.word-mute.vue';
@@ -218,7 +219,7 @@ watch([
suggestReload();
});
async function unrenoteMute(user, ev) {
async function unrenoteMute(user: Misskey.entities.UserDetailed, ev: PointerEvent) {
os.popupMenu([{
text: i18n.ts.renoteUnmute,
icon: 'ti ti-x',
@@ -229,7 +230,7 @@ async function unrenoteMute(user, ev) {
}], ev.currentTarget ?? ev.target);
}
async function unmute(user, ev) {
async function unmute(user: Misskey.entities.UserDetailed, ev: PointerEvent) {
os.popupMenu([{
text: i18n.ts.unmute,
icon: 'ti ti-x',
@@ -240,7 +241,7 @@ async function unmute(user, ev) {
}], ev.currentTarget ?? ev.target);
}
async function unblock(user, ev) {
async function unblock(user: Misskey.entities.UserDetailed, ev: PointerEvent) {
os.popupMenu([{
text: i18n.ts.unblock,
icon: 'ti ti-x',

View File

@@ -30,7 +30,7 @@ const emit = defineEmits<{
(ev: 'save', value: (string[] | string)[]): void;
}>();
const render = (mutedWords) => mutedWords.map(x => {
const render = (mutedWords: (string | string[])[]) => mutedWords.map(x => {
if (Array.isArray(x)) {
return x.join(' ');
} else {
@@ -46,13 +46,13 @@ watch(mutedWords, () => {
});
async function save() {
const parseMutes = (mutes) => {
const parseMutes = (mutes: string) => {
// split into lines, remove empty lines and unnecessary whitespace
let lines = mutes.trim().split('\n').map(line => line.trim()).filter(line => line !== '');
let lines = mutes.trim().split('\n').map(line => line.trim()).filter(line => line !== '') as (string | string[])[];
// check each line if it is a RegExp or not
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
const line = lines[i] as string;
const regexp = line.match(/^\/(.+)\/(.*)$/);
if (regexp) {
// check that the RegExp is valid

View File

@@ -13,16 +13,16 @@ SPDX-License-Identifier: AGPL-3.0-only
<FormSection first>
<template #label>{{ i18n.ts.notificationRecieveConfig }}</template>
<div class="_gaps_s">
<MkFolder v-for="type in notificationTypes.filter(x => !nonConfigurableNotificationTypes.includes(x))" :key="type">
<MkFolder v-for="type in configurableNotificationTypes" :key="type">
<template #label>{{ i18n.ts._notification._types[type] }}</template>
<template #suffix>
{{
$i.notificationRecieveConfig[type]?.type === 'never' ? i18n.ts.none :
$i.notificationRecieveConfig[type]?.type === 'following' ? i18n.ts.following :
$i.notificationRecieveConfig[type]?.type === 'follower' ? i18n.ts.followers :
$i.notificationRecieveConfig[type]?.type === 'mutualFollow' ? i18n.ts.mutualFollow :
$i.notificationRecieveConfig[type]?.type === 'followingOrFollower' ? i18n.ts.followingOrFollower :
$i.notificationRecieveConfig[type]?.type === 'list' ? i18n.ts.userList :
$i.notificationRecieveConfig[type as (typeof configurableNotificationTypes)[number]]?.type === 'never' ? i18n.ts.none :
$i.notificationRecieveConfig[type as (typeof configurableNotificationTypes)[number]]?.type === 'following' ? i18n.ts.following :
$i.notificationRecieveConfig[type as (typeof configurableNotificationTypes)[number]]?.type === 'follower' ? i18n.ts.followers :
$i.notificationRecieveConfig[type as (typeof configurableNotificationTypes)[number]]?.type === 'mutualFollow' ? i18n.ts.mutualFollow :
$i.notificationRecieveConfig[type as (typeof configurableNotificationTypes)[number]]?.type === 'followingOrFollower' ? i18n.ts.followingOrFollower :
$i.notificationRecieveConfig[type as (typeof configurableNotificationTypes)[number]]?.type === 'list' ? i18n.ts.userList :
i18n.ts.all
}}
</template>
@@ -30,7 +30,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<XNotificationConfig
:userLists="userLists"
:value="$i.notificationRecieveConfig[type] ?? { type: 'all' }"
:configurableTypes="onlyOnOrOffNotificationTypes.includes(type) ? ['all', 'never'] : undefined"
:configurableTypes="(onlyOnOrOffNotificationTypes as string[]).includes(type) ? ['all', 'never'] : undefined"
@update="(res) => updateReceiveConfig(type, res)"
/>
</MkFolder>
@@ -83,9 +83,11 @@ import MkFeatureBanner from '@/components/MkFeatureBanner.vue';
const $i = ensureSignin();
const nonConfigurableNotificationTypes = ['note', 'roleAssigned', 'followRequestAccepted', 'test', 'exportCompleted'] satisfies (typeof notificationTypes[number])[] as string[];
const nonConfigurableNotificationTypes = ['note', 'roleAssigned', 'followRequestAccepted', 'test', 'exportCompleted'] as const satisfies (typeof notificationTypes[number])[];
const onlyOnOrOffNotificationTypes = ['app', 'achievementEarned', 'login', 'createToken', 'scheduledNotePosted', 'scheduledNotePostFailed'] satisfies (typeof notificationTypes[number])[] as string[];
const configurableNotificationTypes = notificationTypes.filter(type => !nonConfigurableNotificationTypes.includes(type as any)) as Exclude<typeof notificationTypes[number], typeof nonConfigurableNotificationTypes[number]>[];
const onlyOnOrOffNotificationTypes = ['app', 'achievementEarned', 'login', 'createToken', 'scheduledNotePosted', 'scheduledNotePostFailed'] as const satisfies (typeof notificationTypes[number])[];
const allowButton = useTemplateRef('allowButton');
const pushRegistrationInServer = computed(() => allowButton.value?.pushRegistrationInServer);

View File

@@ -40,7 +40,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div class="_gaps_s">
<div v-for="policy in Object.keys($i.policies)" :key="policy">
{{ policy }} ... {{ $i.policies[policy] }}
{{ policy }} ... {{ $i.policies[policy as keyof typeof $i.policies] }}
</div>
</div>
</MkFolder>

View File

@@ -58,7 +58,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #key>{{ i18n.ts.permission }}</template>
<template #value>
<ul style="margin-top: 0; margin-bottom: 0;">
<li v-for="permission in plugin.permissions" :key="permission">{{ i18n.ts._permissions[permission] }}</li>
<li v-for="permission in plugin.permissions" :key="permission">{{ (i18n.ts._permissions as any)[permission] ?? permission }}</li>
<li v-if="!plugin.permissions || plugin.permissions.length === 0">{{ i18n.ts.none }}</li>
</ul>
</template>
@@ -96,6 +96,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { nextTick, ref, computed } from 'vue';
import { isSafeMode } from '@@/js/config.js';
import type { Plugin } from '@/plugin.js';
import FormLink from '@/components/form/link.vue';
import MkSwitch from '@/components/MkSwitch.vue';
@@ -110,7 +111,6 @@ import { i18n } from '@/i18n.js';
import { definePage } from '@/page.js';
import { changePluginActive, configPlugin, pluginLogs, uninstallPlugin, reloadPlugin } from '@/plugin.js';
import { prefer } from '@/preferences.js';
import { isSafeMode } from '@@/js/config.js';
import * as os from '@/os.js';
const plugins = prefer.r.plugins;

View File

@@ -1042,7 +1042,7 @@ function removePinnedList() {
function enableAllDataSaver() {
const g = { ...prefer.s.dataSaver };
Object.keys(g).forEach((key) => { g[key] = true; });
Object.keys(g).forEach((key) => { (g as any)[key] = true; });
dataSaver.value = g;
}
@@ -1050,7 +1050,7 @@ function enableAllDataSaver() {
function disableAllDataSaver() {
const g = { ...prefer.s.dataSaver };
Object.keys(g).forEach((key) => { g[key] = false; });
Object.keys(g).forEach((key) => { (g as any)[key] = false; });
dataSaver.value = g;
}

View File

@@ -163,6 +163,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, reactive, ref, watch } from 'vue';
import * as Misskey from 'misskey-js';
import MkButton from '@/components/MkButton.vue';
import MkInput from '@/components/MkInput.vue';
import MkSwitch from '@/components/MkSwitch.vue';
@@ -266,8 +267,8 @@ function save() {
}
}
function changeAvatar(ev) {
async function done(driveFile) {
function changeAvatar(ev: PointerEvent) {
async function done(driveFile: Misskey.entities.DriveFile) {
const i = await os.apiWithDialog('i/update', {
avatarId: driveFile.id,
});
@@ -315,8 +316,8 @@ function changeAvatar(ev) {
}], ev.currentTarget ?? ev.target);
}
function changeBanner(ev) {
async function done(driveFile) {
function changeBanner(ev: PointerEvent) {
async function done(driveFile: Misskey.entities.DriveFile) {
const i = await os.apiWithDialog('i/update', {
bannerId: driveFile.id,
});

View File

@@ -15,21 +15,16 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { ref, computed } from 'vue';
import type { MenuItem } from '@/types/menu.js';
import { computed } from 'vue';
import MkButton from '@/components/MkButton.vue';
import MkFolder from '@/components/MkFolder.vue';
import * as os from '@/os.js';
import { misskeyApi } from '@/utility/misskey-api.js';
import { $i } from '@/i.js';
import { i18n } from '@/i18n.js';
import { definePage } from '@/page.js';
import { prefer } from '@/preferences.js';
import { deleteCloudBackup, listCloudBackups } from '@/preferences/utility.js';
const backups = await listCloudBackups();
function del(backup) {
function del(backup: { name: string }): void {
deleteCloudBackup(backup.name);
}

View File

@@ -32,6 +32,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref, computed, watch } from 'vue';
import type { SoundType } from '@/utility/sound.js';
import type { SoundStore } from '@/preferences/def.js';
import MkSelect from '@/components/MkSelect.vue';
import MkButton from '@/components/MkButton.vue';
import MkRange from '@/components/MkRange.vue';
@@ -41,7 +42,6 @@ import { useMkSelect } from '@/composables/use-mkselect.js';
import { misskeyApi } from '@/utility/misskey-api.js';
import { playMisskeySfxFile, soundsTypes, getSoundDuration } from '@/utility/sound.js';
import { selectFile } from '@/utility/drive.js';
import type { SoundStore } from '@/preferences/def.js';
const props = defineProps<{
def: SoundStore;
@@ -100,7 +100,7 @@ const friendlyFileName = computed<string>(() => {
return i18n.ts._soundSettings.driveFileWarn;
});
function selectSound(ev) {
function selectSound(ev: PointerEvent) {
selectFile({
anchorElement: ev.currentTarget ?? ev.target,
multiple: false,

View File

@@ -100,11 +100,14 @@ function getSoundTypeName(f: SoundType): string {
}
}
async function updated(type: keyof typeof sounds.value, sound) {
const v: SoundStore = {
async function updated(type: keyof typeof sounds.value, sound: { type: SoundType; fileId?: string; fileUrl?: string; volume: number; }) {
const v: SoundStore = sound.type === '_driveFile_' ? {
type: sound.type,
fileId: sound.fileId!,
fileUrl: sound.fileUrl!,
volume: sound.volume,
} : {
type: sound.type,
fileId: sound.fileId,
fileUrl: sound.fileUrl,
volume: sound.volume,
};

View File

@@ -306,7 +306,7 @@ function changeThemesSyncEnabled(value: boolean) {
}
}
function onThemeContextmenu(theme: Theme, ev: MouseEvent) {
function onThemeContextmenu(theme: Theme, ev: PointerEvent) {
os.contextMenu([{
type: 'label',
text: theme.name,