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

Get RouteId string from a route at run/compiletime #13253

Open
Mardoxx opened this issue Dec 29, 2024 · 0 comments
Open

Get RouteId string from a route at run/compiletime #13253

Mardoxx opened this issue Dec 29, 2024 · 0 comments
Labels
feature / enhancement New feature or request

Comments

@Mardoxx
Copy link

Mardoxx commented Dec 29, 2024

Describe the problem

I don't want to rely on magic strings to do my routing.

Describe the proposed solution

import {routeId} from '$routes/foo/[bar]/baz';

routeId === "/foo/[bar]/baz;"

Alternatives considered

Currently I am doing

/foo/[bar]/baz/index.ts

import type { RouteId } from "./$types";

export const routeId: RouteId = "/foo/[bar]/baz";

Which is /okay/ becasue typescript tells me off if the route has changed, but it would be good if there was a builtin.

I'm currently using oob sveltekit so I'm not sure if there is an acceptable generalised solution for e.g. custom routing.

Importance

nice to have

Additional Information

No response

@eltigerchino eltigerchino added the feature / enhancement New feature or request label Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature / enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants