refactor: 返り値の型を改善

This commit is contained in:
zyoshoka 2024-02-07 15:25:21 +09:00
parent c8c16c5357
commit 3cf640c2a0
No known key found for this signature in database
GPG Key ID: 0C2CB8FBA309A5B8
3 changed files with 5 additions and 5 deletions

View File

@ -56,7 +56,7 @@ const props = withDefaults(defineProps<{
});
const emit = defineEmits<{
(ev: 'done', v: any): void;
(ev: 'done', v: string): void;
(ev: 'close'): void;
(ev: 'closed'): void;
}>();
@ -64,7 +64,7 @@ const emit = defineEmits<{
const modal = shallowRef<InstanceType<typeof MkModal>>();
const picker = shallowRef<InstanceType<typeof MkEmojiPicker>>();
function chosen(emoji: any) {
function chosen(emoji: string) {
emit('done', emoji);
if (props.choseAndClose) {
modal.value?.close();

View File

@ -435,7 +435,7 @@ export function waiting(): Promise<void> {
});
}
export function form(title: string, form: any): Promise<unknown> {
export function form(title: string, form: any): Promise<{ canceled?: boolean, result?: unknown }> {
return new Promise(resolve => {
popup(defineAsyncComponent(() => import('@/components/MkFormDialog.vue')), { title, form }, {
done: result => {
@ -488,7 +488,7 @@ export async function selectDriveFolder(multiple: boolean): Promise<Misskey.enti
});
}
export async function pickEmoji(src: HTMLElement | null, opts): Promise<unknown> {
export async function pickEmoji(src: HTMLElement, opts: ComponentProps<typeof MkEmojiPickerDialog>): Promise<string> {
return new Promise(resolve => {
popup(MkEmojiPickerDialog, {
src,

View File

@ -213,7 +213,7 @@ async function pickEmoji(itemsRef: Ref<string[]>, ev: MouseEvent) {
os.pickEmoji(getHTMLElement(ev), {
showPinned: false,
}).then(it => {
const emoji = it as string;
const emoji = it;
if (!itemsRef.value.includes(emoji)) {
itemsRef.value.push(emoji);
}