Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated TS file doesn't specify if a param is optional #686

Closed
alexmccabe opened this issue Nov 2, 2023 · 3 comments
Closed

Generated TS file doesn't specify if a param is optional #686

alexmccabe opened this issue Nov 2, 2023 · 3 comments

Comments

@alexmccabe
Copy link
Contributor

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.

@bakerkretzmar
Copy link
Collaborator

Yeah it would definitely be possible to include this info in the generated .d.ts file, I played around with it at one point.

@alexmccabe
Copy link
Contributor Author

@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

@alexmccabe
Copy link
Contributor Author

alexmccabe commented Dec 18, 2023

I've opened a PR for this request #697

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants