Skip to content

Rerun LKG to remove 'awaited' type - #37616

Merged
Ron Buckton (rbuckton) merged 1 commit into
masterfrom
lkg-without-awaited
Mar 31, 2020
Merged

Ron Buckton (rbuckton) merged 1 commit into
masterfrom
lkg-without-awaited

Conversation

@rbuckton

Copy link
Copy Markdown
Contributor

This regenerates the LKG in master now that we've reverted 'awaited'.

@muuki88

Copy link
Copy Markdown

This commit removes the WindowConsole object. Was this intented? It breaks window.console access with Property 'console' does not exist on type 'Window'

@muuki88

Copy link
Copy Markdown

It seem that this was introduced in microsoft/TypeScript-DOM-lib-generator#831

@gaspard

Copy link
Copy Markdown

This commit breaks the generateKey overloads in SubtleCrypto...

I have no idea how to fix this...

interface SubtleCrypto {
    // AlgorithmIdentifier is too generic and masks other overloads. This definition should come last.
    // Previous definition had only 'string' which was more specific and prevented other definitions from
    // being hidden.
    generateKey(algorithm: AlgorithmIdentifier, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair | CryptoKey>;
    generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams | DhKeyGenParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKeyPair>;
    generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey>;
}

This breaks compilation for this perfectly correct code:

export const encAlgo: AesKeyGenParams = {
  name: 'AES-CBC',
  length: 128,
}

crypto.subtle
      .generateKey(encAlgo, true, ['decrypt', 'encrypt']) // ==> THIS USES THE GENERIC OVERLOAD
      // Symetric crypto: should see a CryptoKey
      .then(cryptoKey => { // SEES cryptoKey as CryptoKey | CryptoKeyPair
        crypto.subtle
          .exportKey('raw', cryptoKey) // FAILS NOW
          .then(keyBuffer => {
             // ...
          }, reject)
      }, reject)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants