What real anti-pattern in your code is mixing types, and this has nothing to to with!!. Your function may receive anObject, aString, or anull, and had no notion of it. Another anti-pattern istypeof for such cases.
This is solved with anything from the Maybe monad to typing your data correctly:
constdata1={image:'bob.jpeg',error:null}constdata2={image:null,error:'Bob was not found'}constdata3={image:null,error:'Wrong authentication'}
In the real word,!! is not needed for other reasons. !! converts from "falsy" tofalse, but it has no value by itself, as any JS context expecting a boolean, does it for you:
// if and ternaryif(2)'this is true'if('')'this is false'[]?'any array is true':newError('must never happen')0?'zero is not true':'it is false'