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

JavaScript: Shorthand to toggle a non-boolean value

$
0
0

Is there a better shorthand to toggle foo?

type Foo = 'BAR' | 'BAZ';let foo: Foo = 'BAR';const toggleFoo = () => {  foo = foo === 'BAR' ? 'BAZ' : foo;};toggleFoo();

Viewing all articles
Browse latest Browse all 6290

Trending Articles



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