Next.js Discord

Discord Forum

JSX Namespace doesn't exist

Answered
Scale parasitoid posted this in #help-forum
Open in Discord
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.
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

Scale parasitoidOP
ignoring all the other debug stuff everything works on local development
@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.
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
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