【发布时间】:2020-08-08 04:28:31
【问题描述】:
我正在按照https://web.dev/web-otp/ 上的说明在我的 Angular 应用程序中实现 Web OTP API。但是当添加下面的代码时,它会抛出错误:
const content = await window.navigator['credentials'].get({
otp: { transport: ['sms'] },
signal: abortController.signal
});
这是错误信息:
Error TS2769 (TS) No overload matches this call.
Overload 1 of 2, '(options?: CredentialRequestOptions): Promise<CredentialType>', gave the following error.
Argument of type '{ otp: { transport: string[]; }; signal: AbortSignal; }' is not assignable to parameter of type 'CredentialRequestOptions'.
Object literal may only specify known properties, and 'otp' does not exist in type 'CredentialRequestOptions'.
Overload 2 of 2, '(options?: CredentialRequestOptions): Promise<Credential>', gave the following error.
Argument of type '{ otp: { transport: string[]; }; signal: AbortSignal; }' is not assignable to parameter of type 'CredentialRequestOptions'.
Object literal may only specify known properties, and 'otp' does not exist in type 'CredentialRequestOptions'.
我添加了@types/webappsec-credential-management,但我相信它尚未更新以支持otp。
有什么解决办法吗?
【问题讨论】:
标签: angular typescript google-chrome typescript-typings