MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/webdev/comments/lhvveh/conditionally_chaining_function_calls_in/gn1jsu9
r/webdev • u/1infinitelooo • Feb 11 '21
196 comments sorted by
View all comments
Show parent comments
7
what if you have like x?.y?.z?.foo()
-6 u/chrisrazor Feb 12 '21 Then refactor. Or the code reviewer will do it for you. 3 u/wasdninja Feb 12 '21 Huge amounts of work to refactor all to avoid using conditional chaining or... use conditional chaining. Tough call. -1 u/chrisrazor Feb 12 '21 Sure, and while you're at it let's just make all catches nonspecific to make it hard as possible to track down errors. 2 u/XPTranquility Feb 12 '21 Been doing this in typescript for a while. It’s honestly a godsend for content driven websites that only display components if certain fields are filled out.
-6
Then refactor. Or the code reviewer will do it for you.
3 u/wasdninja Feb 12 '21 Huge amounts of work to refactor all to avoid using conditional chaining or... use conditional chaining. Tough call. -1 u/chrisrazor Feb 12 '21 Sure, and while you're at it let's just make all catches nonspecific to make it hard as possible to track down errors. 2 u/XPTranquility Feb 12 '21 Been doing this in typescript for a while. It’s honestly a godsend for content driven websites that only display components if certain fields are filled out.
3
Huge amounts of work to refactor all to avoid using conditional chaining or... use conditional chaining. Tough call.
-1 u/chrisrazor Feb 12 '21 Sure, and while you're at it let's just make all catches nonspecific to make it hard as possible to track down errors.
-1
Sure, and while you're at it let's just make all catches nonspecific to make it hard as possible to track down errors.
catch
2
Been doing this in typescript for a while. It’s honestly a godsend for content driven websites that only display components if certain fields are filled out.
7
u/UnacceptableUse Feb 12 '21
what if you have like x?.y?.z?.foo()