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

型をいい感じにして空配列を渡したときにエラーにならないように #228

Merged
merged 1 commit into from
May 5, 2024

Conversation

mehm8128
Copy link
Member

@mehm8128 mehm8128 commented Apr 28, 2024

close #227
typescriptに敗北したのでany使ってます
open-apiの型定義がinterfaceじゃなくてtype aliasだったらエラーにならないらしいけどなんでinterfaceだとエラーになるのかよく分かってない
多分これ: microsoft/TypeScript#50087

@mehm8128 mehm8128 requested a review from ras0q April 28, 2024 02:39
@mehm8128 mehm8128 self-assigned this Apr 28, 2024
Copy link
Member

@ras0q ras0q left a comment

Choose a reason for hiding this comment

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

みました

Comment on lines 10 to +11
const query = _query.toLowerCase()
// valueがstringなので、item[key]もstringなはず
return list.filter(item =>
(item[key] as string).toLowerCase().includes(query)
)
return list.filter(item => item[key].toLowerCase().includes(query))
Copy link
Member

Choose a reason for hiding this comment

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

imo: query定義せずにワンライナーで書くほうが好み(可読性変わらなそう)

Copy link
Member Author

Choose a reason for hiding this comment

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

listの要素数分だけtoLowerCaseするのがなんか嫌なのでこうしてます(多分どっちでもあんまり変わらない)

Copy link
Member

Choose a reason for hiding this comment

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

僕が馬鹿でした

@mehm8128 mehm8128 merged commit dc0a3a4 into main May 5, 2024
7 checks passed
@mehm8128 mehm8128 deleted the fix/searchList branch May 5, 2024 05:52
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.

search.tsのリファクタ
2 participants