-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Description
Describe what's incorrect/missing in the documentation
Hello,
The documentation comment for useLocation().hash states:
A URL fragment identifier, beginning with a #.
If this is a strict rule, it would be convenient if these values could be typed as '' | `#${string}` instead of string. This is especially useful if hash is passed along to another function that impose a stricter input type, and will allow us to avoid an if/else clause or having to type cast.
Likewise, the documentation comment for useLocation().search states:
A URL search string, beginning with a ?.
So this value could be typed as '' | `?${string}` instead of string. (Alternatively, '' | `?${string}=${string}` or '' | `?${string}=${string}` | `?${string}=${string}&${string}=${string}` would be valid too. However, this would probably add unnecessary confusion because it doesn’t suggest that the string can contain multiple &${string}=${string} segments).
I’m willing to submit a PR