-
Notifications
You must be signed in to change notification settings - Fork 29
Closed
Description
現在、queries.fieldsに渡す情報はカンマ区切りのstringですが、[ 'title', 'publishedAt' ]のようにstring[]も渡せるようにして欲しいです。
理由としては、今後配列形式であれば APIスキーマ情報 をtypescriptで型定義することで、queries.fieldsなどに渡すパラメーターに型補完を効かせることができるのではないか?と考えたためです。
example: string[] => ( 'id' | 'title' | 'body' )[]
Before
client.get({
endpoint: 'endpoint',
queries: { fields: 'title,publishedAt' },
})
After
client.get({
endpoint: 'endpoint',
queries: { fields: [ 'title', 'publishedAt' ] },
})
Feature
type EndPointContent = {
id: string
name: string
body: string
}
client.get<EndPointContent>({
endpoint: 'endpoint',
queries: { fields: [ 'id', 'name' ] }, // 型補完が効いている状態
})
hiro08gh, shibe97 and dc7290
Metadata
Metadata
Assignees
Labels
No labels