1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-07-25 08:35:02 +02:00

fix: frontend-embedで見つけた型エラーの修正 (#17650)

This commit is contained in:
おさむのひと
2026-07-02 09:24:50 +09:00
committed by GitHub
parent 7e29f04287
commit 174fb434cc
5 changed files with 10 additions and 7 deletions

View File

@@ -149,7 +149,7 @@ const isRenote = Misskey.note.isPureRenote(note.value);
const rootEl = shallowRef<HTMLElement>();
const renoteTime = shallowRef<HTMLElement>();
const appearNote = computed(() => getAppearNote(note.value));
const appearNote = computed(() => getAppearNote(note.value) ?? note.value);
const showContent = ref(false);
const parsed = computed(() => appearNote.value.text ? mfm.parse(appearNote.value.text) : null);
const isLong = shouldCollapsed(appearNote.value, []);

View File

@@ -244,7 +244,7 @@ const fetchMore = async (): Promise<void> => {
if (i === 10) item._shouldInsertAd_ = true;
}
const reverseConcat = _res => {
const reverseConcat = (_res: MisskeyEntity[]) => {
const oldHeight = scrollableElement.value ? scrollableElement.value.scrollHeight : getBodyScrollHeight();
const oldScroll = scrollableElement.value ? scrollableElement.value.scrollTop : window.scrollY;

View File

@@ -27,8 +27,8 @@ const initialReactions = new Set(Object.keys(props.note.reactions));
const reactions = ref<[string, number][]>([]);
const hasMoreReactions = ref(false);
if (props.note.myReaction && !Object.keys(reactions.value).includes(props.note.myReaction)) {
reactions.value[props.note.myReaction] = props.note.reactions[props.note.myReaction];
if (props.note.myReaction != null && !(props.note.myReaction in props.note.reactions)) {
reactions.value.push([props.note.myReaction, props.note.reactions[props.note.myReaction]]);
}
function onMockToggleReaction(emoji: string, count: number) {

View File

@@ -46,6 +46,9 @@ const parsed = computed(() => {
});
const render = () => {
return h(props.tag, parsed.value.map(x => typeof x === 'string' ? (props.textTag ? h(props.textTag, x) : x) : slots[x.arg]()));
// slotsの型はTの条件型で決まり文字列インデックスアクセスができないため、
// frontend側の同名コンポーネント (packages/frontend/src/components/global/I18n.vue) と同じくanyでキャストする
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return h(props.tag, parsed.value.map(x => typeof x === 'string' ? (props.textTag ? h(props.textTag, x) : x) : (slots as any)[x.arg]()));
};
</script>

View File

@@ -45,11 +45,11 @@ export async function fetchCustomEmojis(force = false) {
set('lastEmojisFetchedAt', now);
}
let cachedTags;
let cachedTags: string[] | null = null;
export function getCustomEmojiTags() {
if (cachedTags) return cachedTags;
const tags = new Set();
const tags = new Set<string>();
for (const emoji of customEmojis.value) {
for (const tag of emoji.aliases) {
tags.add(tag);