Skip to content

Commit

Permalink
refactor(frontend): os.popup()propsの型チェックを有効化
Browse files Browse the repository at this point in the history
  • Loading branch information
zyoshoka committed Feb 2, 2024
1 parent b0a38c0 commit c3a5d43
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 42 deletions.
1 change: 1 addition & 0 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"vite-plugin-turbosnap": "1.0.3",
"vitest": "0.34.6",
"vitest-fetch-mock": "0.2.2",
"vue-component-type-helpers": "^1.8.27",
"vue-eslint-parser": "9.4.2",
"vue-tsc": "1.8.27"
}
Expand Down
3 changes: 2 additions & 1 deletion packages/frontend/src/os.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// TODO: なんでもかんでもos.tsに突っ込むのやめたいのでよしなに分割する

import { Component, markRaw, Ref, ref, defineAsyncComponent } from 'vue';
import { ComponentExposed } from 'vue-component-type-helpers';
import { EventEmitter } from 'eventemitter3';
import insertTextAtCursor from 'insert-text-at-cursor';
import * as Misskey from 'misskey-js';
Expand Down Expand Up @@ -143,7 +144,7 @@ export function claimZIndex(priority: keyof typeof zIndexes = 'low'): number {
return zIndexes[priority];
}

export async function popup(component: Component, props: Record<string, any>, events = {}, disposeEvent?: string) {
export async function popup<T extends Component>(component: T, props: ComponentExposed<T>['$props'], events = {}, disposeEvent?: string) {
markRaw(component);

const id = ++popupIdCount;
Expand Down
Loading

0 comments on commit c3a5d43

Please sign in to comment.