Closed Evertt closed 1 month ago
This is working with numbers, but I think that it will not work with string as "everything" will be valid.
So I'm not sure what to suggest.
Did you try format_short
that could be a good compromise ?
Any update ?
Feel free to re open if you have news 😉
Is your feature request related to a problem? Please describe.
I just like concise code whenever possible. And currently, when I have these routes:
Then I'd need to use it like this in my svelte component:
Describe the solution you'd like
Before I found this vite plugin I was working on my own version for this, and I generated my routes firstly as a type and then an object that would work like that type. Which allowed me to generate a route with the type
/blog/${number}
. So instead of needing to write:I only needed to write:
And it would get correctly type-checked. If I had written
route("/blog/some-slug")
, typescript would warn me that that was invalid.