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

next-intl/link does not export types #534

Closed
csi-lk opened this issue Sep 26, 2023 · 3 comments
Closed

next-intl/link does not export types #534

csi-lk opened this issue Sep 26, 2023 · 3 comments
Labels
bug Something isn't working unconfirmed Needs triage.

Comments

@csi-lk
Copy link

csi-lk commented Sep 26, 2023

Description

Small one, for example

import type { LinkProps } from "next/link";

works

import type { LinkProps } from "next-intl/link";

does not

As per the docs:

This component wraps next/link(opens in a new tab) and automatically prefixes the href with the current locale as necessary.

Should it re-export the types?

Mandatory reproduction URL (CodeSandbox or GitHub repository)

n/a

Reproduction description

import type { LinkProps } from "next-intl/link";

Module '"next-intl/link"' has no exported member 'LinkProps'

Expected behaviour

That I can use next-intl/link as a drop in replacement

@csi-lk csi-lk added bug Something isn't working unconfirmed Needs triage. labels Sep 26, 2023
@amannn
Copy link
Owner

amannn commented Sep 26, 2023

You can extract the props like so:

import {ComponentProps} from 'react';
import Link from 'next-intl/link';

type LinkProps = ComponentProps<typeof Link>

Exporting the types separately is currently not intended since this works well in my opinion via ComponentProps.

Hope this helps!

@amannn amannn closed this as completed Sep 26, 2023
@daywison-flapper
Copy link

@amannn the href prop is missing when i use dynamic pathnames, so i can't use ComponentProps to access href prop. :(
It's very strange, in template sounds good, but when I use ComponentProps I can't see href prop.
image
image

@amannn
Copy link
Owner

amannn commented Mar 1, 2024

@daywison-flapper Please see "How can I compose the link with its href prop?" in the docs for Link after switching to "Localized pathnames".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unconfirmed Needs triage.
Projects
None yet
Development

No branches or pull requests

3 participants