Is there a better shorthand to toggle foo
?
type Foo = 'ON' | 'OFF';let foo: Foo = 'ON';const toggleFoo = () => { foo = foo === 'ON' ? 'OFF' : foo;};toggleFoo();
Is there a better shorthand to toggle foo
?
type Foo = 'ON' | 'OFF';let foo: Foo = 'ON';const toggleFoo = () => { foo = foo === 'ON' ? 'OFF' : foo;};toggleFoo();