Skip to content

Commit

Permalink
additional changeset tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
dabdine committed Dec 2, 2022
1 parent d9f1f21 commit e9bb4ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .changeset/light-sheep-give.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const action = async (args: ActionArgs): Promise<TypedResponse<string>> =
In this case, Typescript would not show an error even though `42` is clearly not a `string`.

This happens because `json` returns a `TypedResponse<string>`,
but because `TypedReponse<string>` is just `Response & { json: () => Promise<string> }`
and `Response` already defines `{ json: () => Promise<any> }`, type erasure causes `Promise<any>` to be used for `42`.
but because `TypedReponse<string>` was previously just `Response & { json: () => Promise<string> }`
and `Response` already defines `{ json: () => Promise<any> }`, type erasure caused `Promise<any>` to be used for `42`.

To fix this, we explicitly omit the `Response`'s `json` property before intersecting with `{ json: () => Promise<T> }`.

0 comments on commit e9bb4ef

Please sign in to comment.