JSX Namespace doesn't exist
Answered
Scale parasitoid posted this in #help-forum
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:
Or more beautiful:
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 (...
...
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:
Or more beautiful:
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
@B33fb0n3 can you change your type declaration to this:
tsx
props: {
href: string
} & Omit<React.ComponentProps<'a'>, "href">
tsx
export default async function Home(
props: {
href: string;
} & Omit<React.ComponentProps<'a'>, 'href'>
) {
return (...);
}
Or more beautiful:
tsx
type YourType = {
href: string;
} & Omit<React.ComponentProps<'a'>, 'href'>;
export default async function Home(props: YourType) {
return (...
...
Scale parasitoidOP
I can but its an issue everywhere jsx is defined and idk why this is an issue now as it has never been before
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
If you have custom component use
React.ComponentProps<typeof YourComponent>
happy to help
much appreciated