The origin of this post is a conversation in another thread, which I think is interesting, but also a bit of a hijack from the question of the OP there.
I ran tests on unary operators with function expressions. Typescript 2.7.1, though that shouldn’t matter.
let test = !function(x) { return x } (true);
console.log(test); // false
let test = +function(x) { return x } (5);
console.log(test); // 5
let test = +function(x) { return x } (true);
console.log(test); // 1
let test = -function(x) { return x } (5);
console.log(test); // -5
let test = -function(x) { return x } (true);
console.log(test); // -1
let test = ~function(x) { return x } (5);
console.log(test); // -6
let test = ~function(x) { return x } (true);
console.log(test); // -2