Open TheDutchCoder opened 3 weeks ago
The params you shared should match the type defined here and used in this test:
confirmSetup(options: {
elements: StripeElements;
confirmParams?: Partial<setupIntents.ConfirmSetupData>;
redirect: 'if_required';
}): Promise<SetupIntentResult>;
but may require you to type the params explicitly when passed as an object due to type inference.
What happened?
When using
confirmSetup
in TypeScript, with, for example, options like these, TS will throw errors for missing properties likeclientSecret
, even though this is only required in a few of the overloads. It seems to have trouble selecting the proper one.Additionally, the type for
redirect
is set to"always"
, which is one of the options, but doesn't include"if_required"
. it looks like it just uses the last overload at all times, which has this signature:The only workaround I have found is by creating a custom type to force the right overload to be selected:
Environment
Chrome 130 on MacOS 15.0.1
Reproduction
No response