Files
test-repo/tests/flow/refinements/bool.js
T
Christopher Chedeau 3375cfe605 Move tests around (#454)
* new_tests

* move_all_clobbered_tests

* remove all the tests that no longer exist

* re-run flow tests

* Move all the flow tests to tests/flow and prettier to tests/

* Move prettier tests to their own folders

* Add jsfmt files

* run prettier snapshot tests
2017-01-24 14:35:37 -08:00

47 lines
713 B
JavaScript

/* @flow */
function foo(x: ?bool) {
if (x === false) {
return;
}
if (x === true) {
return;
}
x[0]; // error on null and undefined
}
function bar(x: ?bool) {
if (x !== true) {
if (x !== false) {
x[0]; // error on null and undefined
}
}
}
function baz(x: ?bool) {
if (100 * false) {
return;
}
if (false * 100) {
return;
}
}
let tests = [
function(x: { done: true, result: string } | { done: false }) {
if (x.done === true) {
return x.result;
}
return x.result; // error
},
function(x: { done: true, result: string } | { done: false }) {
if (true === x.done) {
return x.result;
}
return x.result; // error
},
];