summaryrefslogtreecommitdiff
path: root/packages/frontend/src/ui
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2025-07-06 19:36:11 +0900
committerGitHub <noreply@github.com>2025-07-06 19:36:11 +0900
commita8abb03d1785791ab40e57ab49c87640914532c9 (patch)
treef80ea7a393a278e29f9642e86be8b341fcb4b95b /packages/frontend/src/ui
parentMerge branch 'develop' of https://github.com/misskey-dev/misskey into develop (diff)
downloadmisskey-a8abb03d1785791ab40e57ab49c87640914532c9.tar.gz
misskey-a8abb03d1785791ab40e57ab49c87640914532c9.tar.bz2
misskey-a8abb03d1785791ab40e57ab49c87640914532c9.zip
refactor(frontend): Formまわりの型強化 (#16260)
* refactor(frontend): Formまわりの型強化 * fix * avoid non-null assertion and add null check for safety * refactor * avoid non-null assertion and add null check for safety * Update clip.vue --------- Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Diffstat (limited to 'packages/frontend/src/ui')
-rw-r--r--packages/frontend/src/ui/deck/tl-note-notification.ts14
1 files changed, 8 insertions, 6 deletions
diff --git a/packages/frontend/src/ui/deck/tl-note-notification.ts b/packages/frontend/src/ui/deck/tl-note-notification.ts
index 728c0d0d29..e9b14e70ee 100644
--- a/packages/frontend/src/ui/deck/tl-note-notification.ts
+++ b/packages/frontend/src/ui/deck/tl-note-notification.ts
@@ -29,7 +29,8 @@ export async function soundSettingsButton(soundSetting: Ref<SoundStore>): Promis
label: i18n.ts.sound,
default: soundSetting.value.type ?? 'none',
enum: soundsTypes.map(f => ({
- value: f ?? 'none', label: getSoundTypeName(f),
+ value: f ?? 'none' as Exclude<SoundType, null> | 'none',
+ label: getSoundTypeName(f),
})),
},
soundFile: {
@@ -81,16 +82,17 @@ export async function soundSettingsButton(soundSetting: Ref<SoundStore>): Promis
},
},
});
+
if (canceled) return;
const res = buildSoundStore(result);
if (res) soundSetting.value = res;
- function buildSoundStore(result: any): SoundStore | null {
- const type = (result.type === 'none' ? null : result.type) as SoundType;
- const volume = result.volume as number;
- const fileId = result.soundFile?.id ?? (soundSetting.value.type === '_driveFile_' ? soundSetting.value.fileId : undefined);
- const fileUrl = result.soundFile?.url ?? (soundSetting.value.type === '_driveFile_' ? soundSetting.value.fileUrl : undefined);
+ function buildSoundStore(r: NonNullable<typeof result>): SoundStore | null {
+ const type = (r.type === 'none' ? null : r.type);
+ const volume = r.volume;
+ const fileId = r.soundFile?.id ?? (soundSetting.value.type === '_driveFile_' ? soundSetting.value.fileId : undefined);
+ const fileUrl = r.soundFile?.url ?? (soundSetting.value.type === '_driveFile_' ? soundSetting.value.fileUrl : undefined);
if (type === '_driveFile_') {
if (!fileUrl || !fileId) {