Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Incorrect type declaration for Crypto.getRandomValues #1194

Copy link
Copy link
Open
@microshine

Description

@microshine
Issue body actions

Bug Report

🔎 Search Terms

WebCrypto, Crypto, getRandomValues

🕗 Version & Regression Information

  • This changed in 4.4

Description

Here is W3C spec for Crypto interface.

[Exposed=(Window,Worker)]
interface Crypto {
  [SecureContext] readonly attribute SubtleCrypto subtle;
  ArrayBufferView getRandomValues(ArrayBufferView array);
};

array argument in getRandomValues is ArrayBufferView but TS uses wrong interface declaration

interface Crypto {
    readonly subtle: SubtleCrypto;
    getRandomValues<T extends ArrayBufferView | null>(array: T): T;
}

Here is Google Chrome exception on getRandomValues usage with an empty argument
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.