Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: 型エラーの修正 #1293

Merged
merged 5 commits into from
Apr 21, 2023
Merged

FIX: 型エラーの修正 #1293

merged 5 commits into from
Apr 21, 2023

Conversation

sabonerune
Copy link
Contributor

内容

npm run typecheck:vue-tsc

で出てくる型エラーの一部を修正しました。

その他

残りのエラーは自分には手に負えそうもなさそうです…

@sabonerune sabonerune requested a review from a team as a code owner April 20, 2023 15:37
@sabonerune sabonerune requested review from Hiroshiba and removed request for a team April 20, 2023 15:37
Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ほぼLGTMです!!

ちなみに手に負えなかった強敵はどのあたりにいましたか・・・?

src/components/AudioDetail.vue Outdated Show resolved Hide resolved
src/components/DictionaryManageDialog.vue Outdated Show resolved Hide resolved
src/components/HotkeySettingDialog.vue Show resolved Hide resolved
src/components/MenuItem.vue Show resolved Hide resolved
sabonerune and others added 4 commits April 21, 2023 07:16
Co-authored-by: Hiroshiba <hihokaruta@gmail.com>
Co-authored-by: Hiroshiba <hihokaruta@gmail.com>
Co-authored-by: Hiroshiba <hihokaruta@gmail.com>
Co-authored-by: Hiroshiba <hihokaruta@gmail.com>
@sabonerune
Copy link
Contributor Author

この状態でnpm run typecheck:vue-tscで出るエラー全部ですね…

const menudata = ref<MenuItemData[]>([

- const menudata = ref<MenuItemData[]>([
+ const menudata: Ref<MenuItemData[]> = ref([


:menudata="root"

のエラーは消えるがmenudataMenuItemData[]に一致しないという雰囲気のエラーが出てしまい解決方法が思い浮かばない


<q-item-label header>{{
engineInfos.get(engineId).name
}}</q-item-label>
</template>
<template
v-for="([, characterInfo], characterIndex) in engineInfos.get(
engineId
).characterInfos"
:key="characterIndex"
>

<div class="text-subtitle">
{{
engineInfos
.get(selectedInfo.engine)
.characterInfos.get(selectedInfo.character).metas.speakerName
}}
</div>
<div
class="markdown"
v-html="
convertMarkdown(
engineInfos
.get(selectedInfo.engine)
.characterInfos.get(selectedInfo.character).metas.policy
)
"
></div>

engineInfos.get(engineId)undefineになる可能性になるが?.を使わずに解決が面倒


MenuItem.vue
v-ifがType Guardとして機能しないのかmenudata.onClickでエラーが出る。


v-for="[feature, value] in Object.entries(
engineManifests[selectedId].supportedFeatures
)"

Object.entriesで型情報が消える。
SupportedFeaturesのキーを直接記述してアクセスすればよさそうな気がするが型の修正の範囲を超えそう・機能増えたときに追加忘れがあるそうで手が出せず。

特に色々試して結局解決しなかったところはこんな感じです

@Hiroshiba
Copy link
Member

なるほどです!!! 詳細ありがとうございます。
本当にどれもこれも手強そうですね・・・。

Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!!

@Hiroshiba
Copy link
Member

マージします!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants