1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-14 11:05:47 +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

@@ -53,19 +53,27 @@ const pointsReply = ref<string>();
const pointsRenote = ref<string>();
const pointsTotal = ref<string>();
function dragListen(fn) {
function dragListen(fn: (ev: MouseEvent | TouchEvent) => void) {
window.addEventListener('mousemove', fn);
window.addEventListener('mouseleave', dragClear.bind(null, fn));
window.addEventListener('mouseup', dragClear.bind(null, fn));
}
function dragClear(fn) {
function dragClear(fn: (ev: MouseEvent | TouchEvent) => void) {
window.removeEventListener('mousemove', fn);
window.removeEventListener('mouseleave', dragClear);
window.removeEventListener('mouseup', dragClear);
window.removeEventListener('mouseleave', dragClear as any);
window.removeEventListener('mouseup', dragClear as any);
}
function onMousedown(ev) {
function getPositionX(event: MouseEvent | TouchEvent) {
return 'touches' in event && event.touches.length > 0 ? event.touches[0].clientX : 'clientX' in event ? event.clientX : 0;
}
function getPositionY(event: MouseEvent | TouchEvent) {
return 'touches' in event && event.touches.length > 0 ? event.touches[0].clientY : 'clientY' in event ? event.clientY : 0;
}
function onMousedown(ev: MouseEvent) {
const clickX = ev.clientX;
const clickY = ev.clientY;
const baseZoom = zoom.value;
@@ -73,8 +81,11 @@ function onMousedown(ev) {
// 動かした時
dragListen(me => {
let moveLeft = me.clientX - clickX;
let moveTop = me.clientY - clickY;
const x = getPositionX(me);
const y = getPositionY(me);
let moveLeft = x - clickX;
let moveTop = y - clickY;
zoom.value = Math.max(1, baseZoom + (-moveTop / 20));
pos.value = Math.min(0, basePos + moveLeft);

View File

@@ -63,7 +63,7 @@ const instances = ref<Misskey.entities.FederationInstance[]>([]);
const charts = ref<Misskey.entities.ChartsInstanceResponse[]>([]);
const fetching = ref(true);
const fetch = async () => {
async function fetchInstances() {
const fetchedInstances = await misskeyApi('federation/instances', {
sort: '+latestRequestReceivedAt',
limit: 5,
@@ -72,14 +72,14 @@ const fetch = async () => {
instances.value = fetchedInstances;
charts.value = fetchedCharts;
fetching.value = false;
};
}
useInterval(fetch, 1000 * 60, {
useInterval(fetchInstances, 1000 * 60, {
immediate: true,
afterMounted: true,
});
function getInstanceIcon(instance): string {
function getInstanceIcon(instance: Misskey.entities.FederationInstance): string {
return getProxiedImageUrlNullable(instance.iconUrl, 'preview') ?? getProxiedImageUrlNullable(instance.faviconUrl, 'preview') ?? '/client-assets/dummy.png';
}

View File

@@ -55,7 +55,7 @@ const { widgetProps, configure } = useWidgetPropsManager(name,
const cloud = useTemplateRef('cloud');
const activeInstances = shallowRef<Misskey.entities.FederationInstance[] | null>(null);
function onInstanceClick(i) {
function onInstanceClick(i: Misskey.entities.FederationInstance) {
os.pageWindow(`/instance-info/${i.host}`);
}
@@ -72,7 +72,7 @@ useInterval(() => {
afterMounted: true,
});
function getInstanceIcon(instance): string {
function getInstanceIcon(instance: Misskey.entities.FederationInstance): string {
return getProxiedImageUrlNullable(instance.iconUrl, 'preview') ?? getProxiedImageUrlNullable(instance.faviconUrl, 'preview') ?? '/client-assets/dummy.png';
}

View File

@@ -52,6 +52,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { onUnmounted, reactive, ref } from 'vue';
import * as Misskey from 'misskey-js';
import { useWidgetPropsManager } from './widget.js';
import type { WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget.js';
import type { FormWithDefault, GetFormResultType } from '@/utility/form.js';
@@ -116,20 +117,22 @@ if (prefer.s['sound.masterVolume']) {
}
for (const domain of ['inbox', 'deliver']) {
prev[domain] = deepClone(current[domain]);
const d = domain as 'inbox' | 'deliver';
prev[d] = deepClone(current[d]);
}
const onStats = (stats) => {
const onStats = (stats: Misskey.entities.QueueStats) => {
for (const domain of ['inbox', 'deliver']) {
prev[domain] = deepClone(current[domain]);
current[domain].activeSincePrevTick = stats[domain].activeSincePrevTick;
current[domain].active = stats[domain].active;
current[domain].waiting = stats[domain].waiting;
current[domain].delayed = stats[domain].delayed;
const d = domain as 'inbox' | 'deliver';
prev[d] = deepClone(current[d]);
current[d].activeSincePrevTick = stats[d].activeSincePrevTick;
current[d].active = stats[d].active;
current[d].waiting = stats[d].waiting;
current[d].delayed = stats[d].delayed;
if (current[domain].waiting > 0 && widgetProps.sound && jammedAudioBuffer.value && !jammedSoundNodePlaying.value) {
if (current[d].waiting > 0 && widgetProps.sound && jammedAudioBuffer.value && !jammedSoundNodePlaying.value) {
const soundNode = sound.createSourceNode(jammedAudioBuffer.value, {}).soundSource;
if (soundNode) {
if (soundNode != null) {
jammedSoundNodePlaying.value = true;
soundNode.onended = () => jammedSoundNodePlaying.value = false;
soundNode.start();
@@ -138,7 +141,7 @@ const onStats = (stats) => {
}
};
const onStatsLog = (statsLog) => {
const onStatsLog = (statsLog: Misskey.entities.QueueStatsLog) => {
for (const stats of [...statsLog].reverse()) {
onStats(stats);
}

View File

@@ -52,7 +52,7 @@ const { widgetProps, configure } = useWidgetPropsManager(name,
const text = ref<string | null>(store.s.memo);
const changed = ref(false);
let timeoutId;
let timeoutId: number | null = null;
const saveMemo = () => {
store.set('memo', text.value);
@@ -61,7 +61,7 @@ const saveMemo = () => {
const onChange = () => {
changed.value = true;
window.clearTimeout(timeoutId);
if (timeoutId != null) window.clearTimeout(timeoutId);
timeoutId = window.setTimeout(saveMemo, 1000);
};

View File

@@ -64,12 +64,12 @@ const connection = useStream().useChannel('main');
const images = ref<Misskey.entities.DriveFile[]>([]);
const fetching = ref(true);
const onDriveFileCreated = (file) => {
function onDriveFileCreated(file: Misskey.entities.DriveFile) {
if (/^image\/.+$/.test(file.type)) {
images.value.unshift(file);
if (images.value.length > 9) images.value.pop();
}
};
}
const thumbnail = (image: Misskey.entities.DriveFile): string => {
return prefer.s.disableShowingAnimatedImages

View File

@@ -41,13 +41,13 @@ import * as Misskey from 'misskey-js';
import { useWidgetPropsManager } from './widget.js';
import type { WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget.js';
import type { FormWithDefault, GetFormResultType } from '@/utility/form.js';
import type { MenuItem } from '@/types/menu.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/utility/misskey-api.js';
import MkContainer from '@/components/MkContainer.vue';
import MkStreamingNotesTimeline from '@/components/MkStreamingNotesTimeline.vue';
import { i18n } from '@/i18n.js';
import { availableBasicTimelines, isAvailableBasicTimeline, isBasicTimeline, basicTimelineIconClass, basicTimelineTypes } from '@/timelines.js';
import type { MenuItem } from '@/types/menu.js';
const name = 'timeline';
@@ -98,7 +98,7 @@ const headerTitle = computed<string>(() => {
} else if (widgetProps.src === 'antenna' && widgetProps.antenna != null) {
return widgetProps.antenna.name;
} else {
return i18n.ts._timelines[widgetProps.src];
return (i18n.ts._timelines as any)[widgetProps.src] ?? '?';
}
});
@@ -107,7 +107,7 @@ const setSrc = (src: TlSrc) => {
save();
};
const choose = async (ev: MouseEvent) => {
const choose = async (ev: PointerEvent) => {
menuOpened.value = true;
const [antennas, lists] = await Promise.all([
misskeyApi('antennas/list'),

View File

@@ -42,7 +42,7 @@ export default function(app: App) {
export const federationWidgets = [
'federation',
'instanceCloud',
];
] as const;
export const widgets = [
'profile',
@@ -74,4 +74,4 @@ export const widgets = [
'chat',
...federationWidgets,
];
] as const;

View File

@@ -5,12 +5,11 @@
import { defineAsyncComponent, reactive, watch } from 'vue';
import { throttle } from 'throttle-debounce';
import { getDefaultFormValues } from '@/utility/form.js';
import type { Reactive } from 'vue';
import type { FormWithDefault, GetFormResultType } from '@/utility/form.js';
import { getDefaultFormValues } from '@/utility/form.js';
import * as os from '@/os.js';
import { deepClone } from '@/utility/clone.js';
import { i18n } from '@/i18n';
export type Widget<P extends Record<string, unknown>> = {
id: string;
@@ -22,7 +21,7 @@ export type WidgetComponentProps<P extends Record<string, unknown>> = {
};
export type WidgetComponentEmits<P extends Record<string, unknown>> = {
(ev: 'updateProps', props: P);
(ev: 'updateProps', props: P): void;
};
export type WidgetComponentExpose = {
@@ -54,7 +53,7 @@ export const useWidgetPropsManager = <F extends FormWithDefault>(
watch(() => props.widget?.data, (to) => {
if (to != null) {
for (const key of Object.keys(propsDef)) {
widgetProps[key] = to[key];
(widgetProps as any)[key] = to[key];
}
}
}, { deep: true });
@@ -66,7 +65,7 @@ export const useWidgetPropsManager = <F extends FormWithDefault>(
const configure = async () => {
const form = deepClone(propsDef);
for (const item of Object.keys(form)) {
form[item].default = widgetProps[item];
form[item].default = (widgetProps as any)[item];
}
const res = await new Promise<{
@@ -97,7 +96,7 @@ export const useWidgetPropsManager = <F extends FormWithDefault>(
}
for (const key of Object.keys(res.result)) {
widgetProps[key] = res.result[key];
(widgetProps as any)[key] = res.result[key];
}
save();