Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Is there a better way to add optional values to an object?

$
0
0

Currently I'm doing the optional addition using something like this

  ...(!!providerId && { providerId }),  ...(!!practiceId && { practiceId }),

Is there some shorthand logic to replace this logic in a graceful manner like

 yield createRemarkRequest.post(PATIENT_REMARK, {  patientId,  ?providerId,  ?practiceId,  noteTypeCode,  note,})

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>