我在我的 ReactJs 项目中使用 Braintree Sandbox 和 typescript。
根据Braintree Docs for focus,可以使用该.focus()
方法聚焦一个字段。
hostedFieldsInstance.focus('number', function (focusErr) {
if (focusErr) {
console.error(focusErr);
}
});
问题:在我的 typeScript 文件中,hostedFieldsInstance 没有将该.focus()
方法显示为有效方法。我收到以下错误:
Property 'focus' does not exist on type 'HostedFields'.ts(2339)
VS Code 也只建议了少数现有的 Braintree 方法,但不是.focus()
: