Next.js Discord

Discord Forum

JSX Namespace doesn't exist

Answered
Scale parasitoid posted this in #help-forum
Open in Discord
Avatar
Scale parasitoidOP
For some reason, my recent builds with NextJS on vercel haven';t been building with this issue, heres my .ts config and all installed packages.
Image
Image
Image
Answered by B33fb0n3
can you change your type declaration to this:
props: {
    href: string
} & Omit<React.ComponentProps<'a'>, "href">

export default async function Home(
    props: {
        href: string;
    } & Omit<React.ComponentProps<'a'>, 'href'>
) {
    
    return (...);
}

Or more beautiful:
type YourType = {
    href: string;
} & Omit<React.ComponentProps<'a'>, 'href'>;

export default async function Home(props: YourType) {
    return (...

...
View full answer

9 Replies

Avatar
Scale parasitoidOP
ignoring all the other debug stuff everything works on local development
Image
Avatar
@Scale parasitoid For some reason, my recent builds with NextJS on vercel haven';t been building with this issue, heres my .ts config and all installed packages.
Avatar
can you change your type declaration to this:
props: {
    href: string
} & Omit<React.ComponentProps<'a'>, "href">

export default async function Home(
    props: {
        href: string;
    } & Omit<React.ComponentProps<'a'>, 'href'>
) {
    
    return (...);
}

Or more beautiful:
type YourType = {
    href: string;
} & Omit<React.ComponentProps<'a'>, 'href'>;

export default async function Home(props: YourType) {
    return (...

...
Answer
Currently seeing if builds with that as a fix
Thank you it worked, im not sure why it was broken but thats fine
Avatar
In the future when you want to use prop types from other components use that method.

If you have custom component use
React.ComponentProps<typeof YourComponent>
happy to help