Closed ferares closed 2 months ago
The Href
type is not intended to be exported. You can likely define a better one based on what is shown in the sitemap docs for localized pathnames that considers the actual pathnames that are available in your app.
I'm going to move this to a discussion since this seems to be more of a usage question.
Is your feature request related to a problem? Please describe.
I'm struggling to define an
Href
type that I can then on the return values ofcreateLocalizedPathnamesNavigation
(getPathname
,Link
andredirect
)I've defined it as
export type Href = Parameters<typeof getPathname>[0]["href"]
which seems to work fine forgetPathname
but it does not work for eitherredirect
nor theLink
component.Describe the solution you'd like
An importable Href type that's compatible with the
href
prop of theLink
component and thehref
param of bothgetPathname
andredirect
functions.Describe alternatives you've considered
As of now I'm defining the Href type as
Parameters<typeof getPathname>[0]["href"]
and using// @ts-expect-error
to silence errors when passing values intoLink
components orredirect
calls