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