-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed as not planned
Labels
Milestone
Description
Describe the problem
- Consider the base variable
- Consider other paths on the same site, but outside of kit (special type in App?)
- Consider external links
- Slugs types need to be taken from params
- Consider hash, parameters, different protocols
- Use these types in kit wherever possible (redirect, load params, ...)
Example:
/*
existing paths:
[
"/",
"/blog",
"/blog/post/[post]",
"/blog/tag/[tag=integer]",
"/shop/[...slugs]",
]
*/
throw redirect(301, "/");
throw redirect(301, "/blog");
throw redirect(301, "/blog/qwe"); //type error
throw redirect(301, "/blog/post"); //type error
throw redirect(301, "/blog/post/qwe");
throw redirect(301, "/blog/tag/1");
throw redirect(301, "/blog/tag/qwe"); //type error
throw redirect(301, "/shop"); //type error
throw redirect(301, "/shop/a/b/c");
throw redirect(301, "https://www.google.com");
throw redirect(301, "/qwe"); //externalDescribe the proposed solution
It is interesting:
- https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html
- https://lihautan.com/extract-parameters-type-from-string-literal-types-with-typescript/
Alternatives considered
No response
Importance
would make my life easier
Additional Information
No response
teemingc, hy2k, mquandalle, felixgirault, aradalvand and 2 more