-
Notifications
You must be signed in to change notification settings - Fork 309
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
Refactor: AudioInfoのパラメータ一覧周りをリファクタ #1322
Refactor: AudioInfoのパラメータ一覧周りをリファクタ #1322
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@y-chan こちらのプルリクエストに行って一度見た内容なのでassignを僕に変更したいと思います!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
リファクタリング助かります!!
@@ -1179,6 +966,13 @@ const adjustSliderValue = ( | |||
overflow-y: scroll; | |||
} | |||
|
|||
.parameters { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
これはスマホ用ですよね、良いと思います!
外観が変わっていないことを確認しました。
レビューを反映しました。 |
...parameters.value.reduce( | ||
(acc, parameter) => ({ | ||
...acc, | ||
[parameter.key]: parameter.slider.state.currentValue.value, | ||
}), | ||
{} as { | ||
[K in typeof parameters.value[number]["key"]]: number; | ||
} | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここの型パズル、自分も挑戦してみたのですが難しいですね。。
今の形はparameter.slider.state.currentValue.value
がnullだとしても通っちゃいそうです。(まあ真上でthrowしているので今のコードは大丈夫なのですが)
真上のnull時throwと混ぜてこんな感じにするのもありかなとか思いました。だいぶ読みづらいですが、まあより正しいはずではある・・・ 😇
...parameters.value.reduce( | |
(acc, parameter) => ({ | |
...acc, | |
[parameter.key]: parameter.slider.state.currentValue.value, | |
}), | |
{} as { | |
[K in typeof parameters.value[number]["key"]]: number; | |
} | |
), | |
...parameters.value.reduce( | |
(acc, parameter) => { | |
if (parameter.slider.state.currentValue.value == undefined) | |
throw new Error( | |
`parameter(${parameter.key}).slider.state.currentValue.value == undefined` | |
); | |
acc[parameter.key] = parameter.slider.state.currentValue.value; | |
return acc; | |
}, | |
{} as { | |
[K in typeof parameters.value[number]["key"]]: number; | |
} | |
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
真上でthrowしてるので、わざわざ書く必要もないかなぁって思ってます
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
真上でthrowしてるのを下に統合しちゃうと型サポートも入って良い感じって意図でした。
TypeScriptの型サポートが中途半端なんすよね・・・
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTMです!!
2点ほどsuggestしているので、気に入ったのあればよかったらどうぞくらいです 🙏
Co-authored-by: Hiroshiba <[email protected]>
たぶん問題ないと思うのでマージします! |
内容
タイトル通り。
関連 Issue
スクリーンショット・動画など
その他
(なし)