feat: add generic type to json method#5436
Conversation
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
json method
|
The const json = await response.body.json() as { data: 'myDataType' };Worse, it would implicitly cause the type to be erroneously "lied" about when used this way: const json: { data: 'myDataType' } = await response.body.json();As typescript implicitly fills the generic to It may lead to implicit bugs and vulnerabilities from assuming the incoming data match the expected type. |
|
similar PRs have been rejected, you can find the reason we declined this in those PRs |
Features
Add support of generic type for
jsonmethod offetchandrequest.Example
Status