Skip to content

Can't iterate over (U)Int8Array, (U)Int16Array, (U)Int32Array, etc. using for ... of #10005

@SetTrend

Description

@SetTrend

This small piece of code doesn't compile:

const bytes = new Uint8Array(8);
window.crypto.getRandomValues(bytes);
for (const byte of bytes) { }

This is the error that's being generated:

C:\Temp>node tsc test.ts
test.ts(5,20): error TS2495: Type 'Uint8Array' is not an array type or a string type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedA PR has been merged for this issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions