Login
Roast topics
Find topics
Find it!
From:
Stack Overflow
(Uncensored)
subscribe
typescript - TS: type guard for ES Map, `if (map.has(key)) map.get(key)` is possibly undefined - Stack Overflow
https://stackoverflow.com/questions/73467278/ts-type-guard-for-es-map-if-map-haskey-map-getkey-is-possibly-undefine
links
backlinks
Roast topics
Find topics
Roast it!
Basically I want an key in obj type guard but for ES Map. When tsconfig.json strict: true is on, TS will error in this case: const map = new Map<string, string>([["foo", "bar&q...