typescript convert true false to 1 or 0 code example Example: javascript cast bool to int + true; // 1 + false; // 0