Typescript error: StrictResponse of generic is not assignable to AsyncResponseResolverReturnType #1823
Closed
4 tasks done
Labels
bug
Something isn't working
needs:triage
Issues that have not been investigated yet.
scope:browser
Related to MSW running in a browser
Prerequisites
Environment check
msw
versionBrowsers
No response
Reproduction repository
https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgCRjMAlApgZ0gOxywBo4ARLAMwEMBXAGxgCEIATATwBV2wS4ALNGDgBfOJSgQQcAOQgcAdxkBuAFDrKtfAGMYwCPjgQA1gHEsMZNXyt6WKAB5O2PAaJwsADxhYbOOAByBgEM9NQARnYOFDQMzGxcPFgAfMkAFL6sAAoQwPgwAFxwODBQeQDmAJSIqnBwUBa0UIZpDa6EWEXOuARE1QC8yTV1dYLoAHTlFhk2OXkwpGkDQ6joLr1Y4wBWOAatPW5YlZW1onCqIuoA9FdwAKKe1OB2cLQ41FOq2m7wXk9gdgAshBtMYrDY7FA4P0jGYLODbPYHAhqGgyuFaD4ivhaCBwvYROkAERXP7PLCkmyQeZEk5fH4CayIqD+GEAbVOZIBWGBoIRkLSKLRwAxWLgAEYRCcALpAA
Reproduction steps
I'm trying to create wrappers around the http.get method to be able to couple endpoints in our backend with their return types. Here is an example of one such wrapper:
Current behavior
This causes a Typescript error:
Type 'StrictResponse' is not assignable to type 'AsyncResponseResolverReturnType'.
Type 'StrictResponse' is not assignable to type 'TResponse extends undefined ? Response : StrictResponse'
Expected behavior
I expect StrictResponse to be assignable to AsyncResponseResolverReturnType.
There is a easy workaround which is to simply use the native Response like so:
this is not as readable however.
Is there some extends clause that I'm missing on TResponse?
The text was updated successfully, but these errors were encountered: