-
-
Notifications
You must be signed in to change notification settings - Fork 217
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
Update documentation for TypeScript usage #1038
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@ScreamZ is attempting to deploy a commit to the next-intl Team on Vercel. A member of the Team first needs to authorize it. |
Update typescript.mdx to support <Link> component wrapping.
Hey, thanks for proposing this change! We do in fact already have docs for how to compose the I think that should already cover this sufficiently, what do you think? Statically typed links for shared pathnames is tracked here: #396 |
Oh… That was hidden in a dropdown. Got it. Your implementation is a bit more verbose but makes sense too. Thanks for your kind answer :) I ended up with export type LinkHref = ComponentProps<typeof L>["href"] | `http${"s" | ""}://${string}` | string;
type LinkProps = Omit<ComponentProps<typeof L>, "href"> & {
href: LinkHref;
};
/**
* A link that works for internal or external links.
* TODO: This is supposed to work as Link from `next/link` handle internal and external link, otherwise we need some logic.
*/
export const Link: React.FC<LinkProps> = ({ href, ...props }: LinkProps) => (
<L
{...props}
href={href as ComponentProps<typeof L>["href"]}
className={twMerge("transition-opacity hover:opacity-70", props.className)}
>
{props.children}
</L>
); I don't know if it's better, it covers the topic that's right, but I just found that some topics are —sometime— hidden deep in nested things and hard to found. Maybe they could be part of a FAQ section? Also not sure about having a dedicated TypeScript section alone, or maybe it should backlink to such content like how to compose links? Or sometimes this might be hard to found. What do you think? The FAQ section makes sense, and is the right answer I think, for all this dropdown stuff. (And we can still backlink each of these dropdown back to the FAQ section too) |
There was an FAQ section at some point but it ended up just collecting random stuff that didn't fit anywhere else better 🙂. I found that it's better to provide optional expandable sections while you're researching about a particular feature. E.g., if you're exploring the docs for The TypeScript docs are actually somewhat an exception currently, maybe we could even move them into the messages docs at some point 🤔. But generally, all of the docs are TypeScript-first. Hope this makes sense for you! |
I'm going to close this for the time being as there are already docs about composing the |
Hello,
Just proposed some documentation improvements.