Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角度订阅和条带订阅保存付款详细信息并创建订阅_Javascript_Angular_Typescript_Stripe Payments - Fatal编程技术网

Javascript 角度订阅和条带订阅保存付款详细信息并创建订阅

Javascript 角度订阅和条带订阅保存付款详细信息并创建订阅,javascript,angular,typescript,stripe-payments,Javascript,Angular,Typescript,Stripe Payments,我一直在关注这个问题。我很难将JavaScript代码转换为TypeScript。在stripe文档中,它们将对象传递给createPaymentMethod函数。在Angular中,它不允许传递,因为对象必须有3个属性,但在文档中,它们只传递一个属性 错误: error TS2345: Argument of type '{ card: any; }' is not assignable to parameter of type '{ card: any; isPaymentRetry: an

我一直在关注这个问题。我很难将JavaScript代码转换为TypeScript。在stripe文档中,它们将对象传递给createPaymentMethod函数。在Angular中,它不允许传递,因为对象必须有3个属性,但在文档中,它们只传递一个属性

错误:

error TS2345: Argument of type '{ card: any; }' is not assignable to parameter of type '{ card: any; isPaymentRetry: any; invoiceId: any; }'.
  Type '{ card: any; }' is missing the following properties from type '{ card: any; isPaymentRetry: any; invoiceId: any; }': isPaymentRetry, invoiceId
代码:


问题在于线路

else {
  this.createPaymentMethod({ card});
}
这里您正在使用一个仅包含
的对象调用
this.createPaymentMethod
,但方法签名需要
isPaymentRetry
发票ID

createPaymentMethod({ card, isPaymentRetry, invoiceId}) {
您需要将此更改为传入缺少参数的值,或者指定
isPaymentRetry
invoiceId
是可选的,例如:

createPaymentMethod({ card: any, isPaymentRetry?: bool, invoiceId?: string }) {
createPaymentMethod({ card: any, isPaymentRetry?: bool, invoiceId?: string }) {