You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The useJsonBody() hook for the API client in SST claims to return string | undefined values only, but if the JSON body contains a list of strings, you need to do weird 'type magic' to make it work.
Here's a sample code snippet in TS:
const{
some_str,
some_str_list
}=useJsonBody();
Here's TS claiming they must all be string | undefined:
Here's how I got around the problem:
conststr_list=some_str_listasunknownasstring[]
EDIT: I am a JS/TS n00b so I apologize if the bug report is nonsense.
The text was updated successfully, but these errors were encountered:
The
useJsonBody()
hook for the API client in SST claims to returnstring | undefined
values only, but if the JSON body contains a list of strings, you need to do weird 'type magic' to make it work.Here's a sample code snippet in TS:
Here's TS claiming they must all be
string | undefined
:Here's how I got around the problem:
EDIT: I am a JS/TS n00b so I apologize if the bug report is nonsense.
The text was updated successfully, but these errors were encountered: