Skip to content

Commit

Permalink
refactor(frontend): os.popup()propsの型チェックを有効化 (misskey-dev#13140)
Browse files Browse the repository at this point in the history
* refactor(frontend): `os.popup()`の`props`の型チェックを有効化

* refactor: `ComponentProps`に書き換え

* refacor: `import type`
  • Loading branch information
zyoshoka authored and AyumuNekozuki committed Feb 16, 2024
1 parent 7485164 commit 467e1b0
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 @@ -9,6 +9,7 @@ import { Component, markRaw, Ref, ref, defineAsyncComponent } from 'vue';
import { EventEmitter } from 'eventemitter3';
import insertTextAtCursor from 'insert-text-at-cursor';
import * as Misskey from 'misskey-js';
import type { ComponentProps } from 'vue-component-type-helpers';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { i18n } from '@/i18n.js';
import MkPostFormDialog from '@/components/MkPostFormDialog.vue';
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: ComponentProps<T>, events = {}, disposeEvent?: string) {
markRaw(component);

const id = ++popupIdCount;
Expand Down
Loading

0 comments on commit 467e1b0

Please sign in to comment.