Is it possible to use type annotations in for...of
loops in TypeScript? For example, like this for array destructuring:
for(let [id, value]: [string, number] of Object.entries(some_object)) { }
Or perhaps like this for object destructuring:
for(let {a, b}: {a: string, b: number} of arr) { }
Important Note: This question specifically pertains to scenarios where some_object
and arr
either lack type information or have incomplete type information.