Skip to content

[Bug]: PayButtonProps.onClick type is incompatible with ButtonProps.onClick under strictFunctionTypes #3861

@jmmarco

Description

@jmmarco

Describe the bug

PayButtonProps interface in dist/es/index.d.ts (line 310) incorrectly extends ButtonProps. The onClick property narrows the event target from HTMLButtonElement | HTMLAnchorElement to just HTMLButtonElement, which TypeScript rejects under strictFunctionTypes (TS2430).

ButtonProps.onClick:

onClick?: (e: h.JSX.TargetedMouseEvent<HTMLButtonElement | HTMLAnchorElement>, callbacks?: { complete?: () => void }) => void;

PayButtonProps.onClick:

onClick?: (e: h.JSX.TargetedMouseEvent<HTMLButtonElement>) => void;

Under strictFunctionTypes, a child interface's method must accept at least the same parameter types as the parent. Since PayButtonProps.onClick only accepts HTMLButtonElement while ButtonProps.onClick accepts HTMLButtonElement | HTMLAnchorElement, TypeScript rejects the extension.

To Reproduce

  • Install @adyen/adyen-web@6.31.1
  • Configure tsconfig.json with "strict": true (which enables strictFunctionTypes) and without "skipLibCheck": true
  • Import anything from @adyen/adyen-web in a TypeScript project
  • Build the project (e.g. tsc or any build tool that runs the TypeScript compiler)
  • See error: TS2430: Interface 'PayButtonProps' incorrectly extends interface 'ButtonProps'
    Expected behavior

PayButtonProps.onClick should have the same signature as ButtonProps.onClick to satisfy TS strict function type checking.

Screenshots

N/A — this is a type-checking error, not a visual bug.

Desktop (please complete the following information):
OS: macOS / Linux (any)
Browser: N/A (build-time error)
Version: @adyen/adyen-web@6.31.1, TypeScript 5.8.x

Smartphone (please complete the following information):

N/A — build-time error, not device-specific.

Additional context

This issue affects any project using strict: true in tsconfig.json without skipLibCheck: true
We are currently working around it with pnpm patch to align the onClick signature with the parent interface.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions