#How to define types in forEach

4 messages · Page 1 of 1 (latest)

woeful hatch
#

Objects.entries(metrics).forEach(([status, count]) => {
.....

})

how to difine types of [status, count] ?

tulip grove
#

Nvm, forgot what Object.entries does

sly ridge
#

if you really want to add explicit types, you can do

Object.entries({x: 42}).forEach(([k,v]: [string, number]) => …)
sly ridge