Convince me I am wrong: This should not be a type error, right? - I asserted it’s an object - I am using `?.` for property access www.typescriptlang.org/play/#code/G...
Post
Object check in TS is a PITA. I started parsing them at the edge of the program (app code). This is probably different for lib code. IDK if you're searching for a solution; if so, this is the approach I was using before: www.typescriptlang.org/play/#code/G...
typescriptlang.orgTS Playground - An online editor for exploring TypeScript and JavaScriptThe Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
This, except I tend to use use hasOwnProperty rather than in. Feels like I usually care about immediate properties in type guards, not inherited ones.
0 reposts0 likes