Open
Description
Whenever an interface is using the typescript features Pick
or Omit
, then we don't get any props from these interfaces/types.
In the case of an interface like this:
import { type LinkProps } from "next/link";
interface MyComponentProps
extends Pick<LinkProps, "prefetch" | "replace" | "scroll" | "shallow"> {
children?: React.ReactNode;
}
export const MyComponent: FunctionComponent<MyComponentProps> = () => {
return <>My Component</>;
};
-> in this case it will only find "children" as prop.
import { type LinkProps } from "next/link";
interface MyComponentProps
extends Pick<LinkProps, "prefetch" | "replace" | "scroll" | "shallow"> {
children?: React.ReactNode;
}
export const MyComponent: FunctionComponent<MyComponentProps> = () => {
return <>My Component</>;
};
The same with Omit<>:
import { type LinkProps } from "next/link";
interface MyComponentProps
extends Omit<LinkProps, "prefetch" | "replace" | "scroll" | "shallow"> {
children?: React.ReactNode;
}
export const MyComponent: FunctionComponent<MyComponentProps> = () => {
return <>My Component</>;
};
Metadata
Assignees
Labels
No labels