Closed alexmccabe closed 3 months ago
Yeah it would definitely be possible to include this info in the generated .d.ts
file, I played around with it at one point.
@bakerkretzmar that would be awesome, do you have any code to share? I'd be happy to open a PR if there is a base I can work from
I've opened a PR for this request #697
Description
The generated TS file marks all params as optional, where really only routes containing
?
should be marked as optional in the generated types.Suggestion
Line 68 of index.d.ts marks every param as optional. It looks like it should be possible to know whether a route contains a question mark during the generating process.
Alternatives
I tried some complicated extraction technique combining the generated TS file and the generated ziggy file, however that depends on the generated ziggy file being a ts file also, with the object set to
as const
.