-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptHelp WantedYou can do thisYou can do this
Milestone
Description
TypeScript Version: 3.9.0-dev.20200328
Search Terms:
WebCrypto, web crypto, SubtleCrypto, subtle, PromiseLike
Expected behavior:
Should compile with no errors.
Actual behavior:
Type 'PromiseLike<CryptoKey>' is missing the following properties from type 'Promise<CryptoKey>': catch, [Symbol.toStringTag]
Related Issues:
microsoft/TypeScript-DOM-lib-generator#843 (pull request that should fix this)
microsoft/TypeScript-DOM-lib-generator#60
microsoft/TypeScript-DOM-lib-generator#47
Code
const keyPromise: Promise<CryptoKey> = crypto.subtle.generateKey({name: 'AES-GCM', length: 256}, true, ['encrypt']);
Output
"use strict";
const keyPromise = crypto.subtle.generateKey({ name: 'AES-GCM', length: 256 }, true, ['encrypt']);
Compiler Options
{
"compilerOptions": {
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"strictBindCallApply": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"alwaysStrict": true,
"esModuleInterop": true,
"declaration": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"moduleResolution": 2,
"target": "ES2017",
"jsx": "React",
"module": "ESNext"
}
}
Playground Link: Provided
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptHelp WantedYou can do thisYou can do this