Skip to content

3.6.0 bug #80

Closed
Closed
@steida

Description

I just updated and my code is broken. I extracted the problematic part.

interface NextLinkProps2 {
  prefetch?: boolean;
  shallow?: boolean;
  scroll?: boolean;
  replace?: boolean;
  onError?(error: any): void;
  href?: string;
  as?: string;
  passHref?: boolean;
  children: React.ReactElement;
}

type AppHref = {
    pathname: "/";
}

export type LinkProps = Assign<
  Overwrite<
    Omit<NextLinkProps2, 'passHref'>,
    {
      // Allow string etc.
      children: ReactNode;
      // Make href required and typed.
      href: AppHref;
    }
  >,
  {
    accessible?: boolean;
    download?: string;
    // style?: StyleProp<TextStyle>;
    // activeStyle?: StyleProp<TextStyle>;
    // We use it for manual focus.
    nativeID?: string;
  }
>;

const foo: LinkProps = { prefetch: true, href: { pathname: '/' } };
Type '{ prefetch: true; href: { pathname: "/"; }; }' is missing the following properties from type 'Pick<Pick<Pick<Pick<Omit<NextLinkProps2, "passHref">, "prefetch" | "shallow" | "scroll" | "replace" | "onError" | "as"> & Pick<{ children: ReactNode; href: { pathname: "/"; } | { pathname: "/me"; } | { ...; } | { ...; } | ({ ...; } & { ...; }); }, "href" | "children">, "prefetch" |

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions