-
Notifications
You must be signed in to change notification settings - Fork 166
Description
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.jsonwith"strict": true(which enablesstrictFunctionTypes) and without"skipLibCheck": true - Import anything from
@adyen/adyen-webin a TypeScript project - Build the project (e.g.
tscor 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.