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

@@ -55,7 +55,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div :class="$style.visibleUsers">
<span v-for="u in visibleUsers" :key="u.id" :class="$style.visibleUser">
<MkAcct :user="u"/>
<button class="_button" style="padding: 4px 8px;" @click="removeVisibleUser(u)"><i class="ti ti-x"></i></button>
<button class="_button" style="padding: 4px 8px;" @click="removeVisibleUser(u.id)"><i class="ti ti-x"></i></button>
</span>
<button class="_buttonPrimary" style="padding: 4px; border-radius: 8px;" @click="addVisibleUser"><i class="ti ti-plus ti-fw"></i></button>
</div>
@@ -476,6 +476,7 @@ function togglePoll() {
}
function addTag(tag: string) {
if (textareaEl.value == null) return;
insertTextAtCursor(textareaEl.value, ` #${tag} `);
}
@@ -486,7 +487,7 @@ function focus() {
}
}
function chooseFileFromPc(ev: MouseEvent) {
function chooseFileFromPc(ev: PointerEvent) {
if (props.mock) return;
os.chooseFileFromPc({ multiple: true }).then(files => {
@@ -495,7 +496,7 @@ function chooseFileFromPc(ev: MouseEvent) {
});
}
function chooseFileFromDrive(ev: MouseEvent) {
function chooseFileFromDrive(ev: PointerEvent) {
if (props.mock) return;
chooseDriveFile({ multiple: true }).then(driveFiles => {
@@ -503,18 +504,18 @@ function chooseFileFromDrive(ev: MouseEvent) {
});
}
function detachFile(id) {
function detachFile(id: Misskey.entities.DriveFile['id']) {
files.value = files.value.filter(x => x.id !== id);
}
function updateFileSensitive(file, sensitive) {
function updateFileSensitive(file: Misskey.entities.DriveFile, isSensitive: boolean) {
if (props.mock) {
emit('fileChangeSensitive', file.id, sensitive);
emit('fileChangeSensitive', file.id, isSensitive);
}
files.value[files.value.findIndex(x => x.id === file.id)].isSensitive = sensitive;
files.value[files.value.findIndex(x => x.id === file.id)].isSensitive = isSensitive;
}
function updateFileName(file, name) {
function updateFileName(file: Misskey.entities.DriveFile, name: Misskey.entities.DriveFile['name']) {
files.value[files.value.findIndex(x => x.id === file.id)].name = name;
}
@@ -704,8 +705,8 @@ function addVisibleUser() {
});
}
function removeVisibleUser(user) {
visibleUsers.value = erase(user, visibleUsers.value);
function removeVisibleUser(id: string) {
visibleUsers.value = visibleUsers.value.filter(u => u.id !== id);
}
function clear() {
@@ -742,7 +743,8 @@ const pastedFileName = 'yyyy-MM-dd HH-mm-ss [{{number}}]';
async function onPaste(ev: ClipboardEvent) {
if (props.mock) return;
if (!ev.clipboardData) return;
if (ev.clipboardData == null) return;
if (textareaEl.value == null) return;
let pastedFiles: File[] = [];
for (const { item, i } of Array.from(ev.clipboardData.items, (data, x) => ({ item: data, i: x }))) {
@@ -767,39 +769,42 @@ async function onPaste(ev: ClipboardEvent) {
if (!renoteTargetNote.value && !quoteId.value && paste.startsWith(url + '/notes/')) {
ev.preventDefault();
os.confirm({
const { canceled } = await os.confirm({
type: 'info',
text: i18n.ts.quoteQuestion,
}).then(({ canceled }) => {
if (canceled) {
insertTextAtCursor(textareaEl.value, paste);
return;
}
quoteId.value = paste.substring(url.length).match(/^\/notes\/(.+?)\/?$/)?.[1] ?? null;
});
if (canceled) {
insertTextAtCursor(textareaEl.value, paste);
return;
}
quoteId.value = paste.substring(url.length).match(/^\/notes\/(.+?)\/?$/)?.[1] ?? null;
}
if (paste.length > 1000) {
ev.preventDefault();
os.confirm({
const { canceled } = await os.confirm({
type: 'info',
text: i18n.ts.attachAsFileQuestion,
}).then(({ canceled }) => {
if (canceled) {
insertTextAtCursor(textareaEl.value, paste);
return;
}
const fileName = formatTimeString(new Date(), pastedFileName).replace(/{{number}}/g, '0');
const file = new File([paste], `${fileName}.txt`, { type: 'text/plain' });
uploader.addFiles([file]);
});
if (canceled) {
insertTextAtCursor(textareaEl.value, paste);
return;
}
const fileName = formatTimeString(new Date(), pastedFileName).replace(/{{number}}/g, '0');
const file = new File([paste], `${fileName}.txt`, { type: 'text/plain' });
uploader.addFiles([file]);
}
}
function onDragover(ev) {
if (!ev.dataTransfer.items[0]) return;
function onDragover(ev: DragEvent) {
if (ev.dataTransfer == null) return;
if (ev.dataTransfer.items[0] == null) return;
const isFile = ev.dataTransfer.items[0].kind === 'file';
if (isFile || checkDragDataType(ev, ['driveFiles'])) {
ev.preventDefault();
@@ -852,13 +857,32 @@ function onDrop(ev: DragEvent): void {
//#endregion
}
type StoredDrafts = {
[key: string]: {
updatedAt: string;
data: {
text: string;
useCw: boolean;
cw: string | null;
visibility: 'public' | 'home' | 'followers' | 'specified';
localOnly: boolean;
files: Misskey.entities.DriveFile[];
poll: PollEditorModelValue | null;
visibleUserIds?: string[];
quoteId: string | null;
reactionAcceptance: 'likeOnly' | 'likeOnlyForRemote' | 'nonSensitiveOnly' | 'nonSensitiveOnlyForLocalLikeOnlyForRemote' | null;
scheduledAt: number | null;
};
};
};
function saveDraft() {
if (props.instant || props.mock) return;
const draftData = JSON.parse(miLocalStorage.getItem('drafts') ?? '{}');
const draftsData = JSON.parse(miLocalStorage.getItem('drafts') ?? '{}') as StoredDrafts;
draftData[draftKey.value] = {
updatedAt: new Date(),
draftsData[draftKey.value] = {
updatedAt: new Date().toISOString(),
data: {
text: text.value,
useCw: useCw.value,
@@ -874,15 +898,15 @@ function saveDraft() {
},
};
miLocalStorage.setItem('drafts', JSON.stringify(draftData));
miLocalStorage.setItem('drafts', JSON.stringify(draftsData));
}
function deleteDraft() {
const draftData = JSON.parse(miLocalStorage.getItem('drafts') ?? '{}');
const draftsData = JSON.parse(miLocalStorage.getItem('drafts') ?? '{}') as StoredDrafts;
delete draftData[draftKey.value];
delete draftsData[draftKey.value];
miLocalStorage.setItem('drafts', JSON.stringify(draftData));
miLocalStorage.setItem('drafts', JSON.stringify(draftsData));
}
async function saveServerDraft(options: {
@@ -924,8 +948,8 @@ async function uploadFiles() {
}
}
async function post(ev?: MouseEvent) {
if (ev) {
async function post(ev?: PointerEvent) {
if (ev != null) {
const el = (ev.currentTarget ?? ev.target) as HTMLElement | null;
if (el && prefer.s.animation) {
@@ -1138,11 +1162,12 @@ function cancel() {
function insertMention() {
os.selectUser({ localOnly: localOnly.value, includeSelf: true }).then(user => {
if (textareaEl.value == null) return;
insertTextAtCursor(textareaEl.value, '@' + Misskey.acct.toString(user) + ' ');
});
}
async function insertEmoji(ev: MouseEvent) {
async function insertEmoji(ev: PointerEvent) {
textAreaReadOnly.value = true;
const target = ev.currentTarget ?? ev.target;
if (target == null) return;
@@ -1176,7 +1201,7 @@ async function insertEmoji(ev: MouseEvent) {
);
}
async function insertMfmFunction(ev: MouseEvent) {
async function insertMfmFunction(ev: PointerEvent) {
if (textareaEl.value == null) return;
let pos = textareaEl.value.selectionStart ?? 0;
let posEnd = textareaEl.value.selectionEnd ?? text.value.length;
@@ -1204,7 +1229,7 @@ async function insertMfmFunction(ev: MouseEvent) {
);
}
function showActions(ev: MouseEvent) {
function showActions(ev: PointerEvent) {
os.popupMenu(postFormActions.map(action => ({
text: action.title,
action: () => {
@@ -1222,7 +1247,7 @@ function showActions(ev: MouseEvent) {
const postAccount = ref<Misskey.entities.UserDetailed | null>(null);
async function openAccountMenu(ev: MouseEvent) {
async function openAccountMenu(ev: PointerEvent) {
if (props.mock) return;
function showDraftsDialog(scheduled: boolean) {
@@ -1312,12 +1337,12 @@ async function openAccountMenu(ev: MouseEvent) {
}, { type: 'divider' }, ...items], (ev.currentTarget ?? ev.target ?? undefined) as HTMLElement | undefined);
}
function showPerUploadItemMenu(item: UploaderItem, ev: MouseEvent) {
function showPerUploadItemMenu(item: UploaderItem, ev: PointerEvent) {
const menu = uploader.getMenu(item);
os.popupMenu(menu, ev.currentTarget ?? ev.target);
}
function showPerUploadItemMenuViaContextmenu(item: UploaderItem, ev: MouseEvent) {
function showPerUploadItemMenuViaContextmenu(item: UploaderItem, ev: PointerEvent) {
const menu = uploader.getMenu(item);
os.contextMenu(menu, ev);
}
@@ -1392,8 +1417,8 @@ onMounted(() => {
nextTick(() => {
// 書きかけの投稿を復元
if (!props.instant && !props.mention && !props.specified && !props.mock) {
const draft = JSON.parse(miLocalStorage.getItem('drafts') ?? '{}')[draftKey.value];
if (draft) {
const draft = JSON.parse(miLocalStorage.getItem('drafts') ?? '{}')[draftKey.value] as StoredDrafts[string] | undefined;
if (draft != null) {
text.value = draft.data.text;
useCw.value = draft.data.useCw;
cw.value = draft.data.cw;