infer route params
Describe the feature
import { H3 } from "h3-nightly" // 2.0.0-20250428-102154-f1115f3;
const app = new H3();
app.get("/:user/id", (e) => {
console.log(e.context.params); // Record<string, string> | undefined;
});
could this be helpful? https://github.com/lukeed/regexparam/blob/main/index.d.ts#L11
Additional information
- [ ] Would you be willing to help implement this feature?
/cc @danielroe Do you think we could have a mini util from fetch-dts to unblock this? (bun also has similar feature in their types)
/cc @danielroe Do you think we could have a mini util from fetch-dts to unblock this? (bun also has similar feature in their types)
but we should make sure it 100% matches rou3 conventions
/cc @danielroe Do you think we could have a mini util from fetch-dts to unblock this? (bun also has similar feature in their types)
In addition to Bun, there is also SvelteKit. If H3 supports this feature, Nitro will benefit greatly.
i think the util that will be created to infer params from a string should be exported by rou3 too :)
Feel feee to open Issue and work on PR for rou3 @huseeiin 😊
Feel feee to open Issue and work on PR for rou3 @huseeiin 😊
unfortunately i'm not a typescript type magician xd
Pending for https://github.com/h3js/rou3/issues/167
https://github.com/h3js/rou3/pull/168 just landed (thanks @luxass ❤️)
now we can move ahead with this.