-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to shorten: "prop" in obj && obj.prop
#173
Comments
"prop" in obj && obj.prop
"prop" in obj&&obj.prop
"
"prop" in obj&&obj.prop
""prop" in obj && obj.prop
"
"prop" in obj && obj.prop
""prop" in obj && obj.prop
\`
"prop" in obj && obj.prop
\`"prop" in obj && obj.prop
"prop" in obj && obj.prop
"prop" in obj && obj.prop
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Optional chaining solved this in the javascript world, but typescript just doesn't like this looser js-style code.
I wish I could just write:
Instead of:
when obj is:
Maybe something like a lodash.get could solve this, using some typescript magic.
Related twitter thread: https://twitter.com/mattpocockuk/status/1579834794472771584
The text was updated successfully, but these errors were encountered: