You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Type generation now expands paths with optionals into their corresponding non-optional paths.
8
+
For example, the path `/user/:id?` gets expanded into `/user` and `/user/:id` to more closely model visitable URLs.
9
+
`href` then uses these expanded (non-optional) paths to construct type-safe paths for your app:
10
+
11
+
```ts
12
+
// original: /user/:id?
13
+
// expanded: /user & /user/:id
14
+
href("/user"); // ✅
15
+
href("/user/:id", { id: 1 }); // ✅
16
+
```
17
+
18
+
This becomes even more important for static optional paths where there wasn't a good way to indicate whether the optional should be included in the resulting path:
19
+
20
+
```ts
21
+
// original: /products/:id/detail?
22
+
23
+
// before
24
+
href("/products/:id/detail?"); // ❌ How can we tell `href` to include or omit `detail?` segment with a complex API?
0 commit comments