Of course this would not work.
typeof(true) is of type 'Boolean' and typeof(1) is of type 'number'.
Do they compare to the same type? Nope, therefore is false in both cases.
Try the following:
let foo = true;
true === foo === true; // returns true.