modern.js icon indicating copy to clipboard operation
modern.js copied to clipboard

[Feature]: Types Routes

Open giancarlosisasi opened this issue 5 months ago • 3 comments

What problem does this feature solve?

Hi there!

Inspired by tanstack router, I have developed a simple script that analyzes the src/routes/ folder and then generates typescript code. Then it is used in our custom <Link /> component to have autocomplete in the paths and params props.

I'm just wondering if there is a plan to develop something like this. If not, maybe I can try to contribute to have this in modernjs?

Thanks!!!

What does the proposed API look like?

Simple path without params

image

Path with required params

For this you must use an object { path, params, searchParams } image

The params property is only required by typescript if the path is a dynamic path. It also autocomplete the required params. image

giancarlosisasi avatar Sep 13 '24 23:09 giancarlosisasi