Open codytooker opened 1 year ago
Hey @codytooker ! I really like the idea and definitely see the value here. It will take some next level TS wizardry but I think it can be done.
There is also the problem of Shared Data which may or not be available on certain routes, so this may not ever really be totally possible but I still think it would help in the long run. I'll investigate as well during my project and if I find anything I'll post back here.
Is it possible to
infer
the types returned forminertia.render()
. This would be a huge value proposition I think for inertia with adonis.As a quick example say I have a controller like so
With React and Typescript I currently do something like this
The problem here is that we aren't really getting good types because we are basically just telling the component what it has not what it will actually receive. It would be extremely valuable to do something like the following
I am not a Typescript expert but I really wonder if this could be possible using some combination of
ReturnType
andinfer