✅ When calling a generic function, how can I tell it that I'm going to be passing null?
I've got a generic function which is something like this:
I always want to call it with a ReturnType specified, but sometimes I want to pass in
null
as the content.
How can I call this to say that I want to pass in null? Ideally, I'd like to be able to do something like this:
Or even:
This second one is possible if I pick any type as the second generic type and change the function definition to this
However, I don't like putting a valid type in there if that's not what I mean, as that will be confusing to future developers (including future myself)
Thanks2 Replies