-
Notifications
You must be signed in to change notification settings - Fork 863
Description
Describe the bug
Though documentation seems to be on the light side, it looks like the intent is to allow indexing of the next_action object with the type parameter, in a statement like this:
payment_intent.next_action[payment_intent.next_action.type]
I think changing string to keyof NextAction on this line would fix this, probably also needing something similar in Refunds.d.ts and SetupIntent.d.ts, but if those files are built from other source, the other source would need to be updated.
To Reproduce
Try to write a statement like payment_intent.next_action[payment_intent.next_action.type] in a TypeScript project.
Observe error TS7053:
expression of type 'string' can't be used to index type 'NextAction'.
No index signature with a parameter of type 'string' was found on type 'NextAction'.
Expected behavior
Either no error on a line like that, or better documentation about the possible values of NextAction.type.
OS
Win11
Node version
Node v24.2.0
Library version
19.2.0-beta.1
API version
2025-09-30.preview
Additional context
It would also be useful to add a component to the React library that parses this data and presents it to the user.