Skip to content

Missing support for Pick<> and Omit<> #925

Open
@rvetere

Description

@rvetere

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions