Why does NSwag's Typescript Client assert null as any
?
#4949
Stan-Stani
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Template code: https://github.com/RicoSuter/NSwag/blob/master/src/NSwag.CodeGeneration.TypeScript/Templates/Client.ProcessResponse.Return.liquid
Generated code looks something like:
Doesn't asserting null as any here defeat the purpose of using TypeScript? Why wouldn't the default TS client type the function as returning
Promise<Thing | null>
?When using these clients, we now have to manually remember that the functions can return null despite their TS typings.
Should this behavior be changed?
Beta Was this translation helpful? Give feedback.
All reactions