// ExistsP

// maybe
function f(x: ?number) {
  if (x) {/* sketchy */}
}

// union
function h(x: number|null) {
  if (x) { /* sketchy */ }
}

// non-void, non-null
function g(x: number) {
  if (x) { /* NOT sketchy */ }
}

// non-falsey prim
function k(x: null | 1) {
  if (x) { /* NOT sketchy */ }
}

// PropExistsP

// optional prop
function l(o: { p?: number, ... }) {
  if (o.p) {/* sketchy */}
}

// maybe prop
function m(o: { p: ?number, ... }) {
  if (o.p) {/* sketchy */}
}

// union
function n(o: { p: number|null|void, ... }) {
  if (o.p) { /* sketchy */ }
}

function q(o: { p: number, ... }) {
  if (o.p) { /* NOT sketchy */ }
}

// Assignment

function z(x: ?string) {
  var assignee;
  if (assignee = x) { /* sketchy */ }
}

var value: ?number = 0;
var defaultVal: number = 7;
var valToUse = value || defaultVal; /* sketchy */

var alwaysFalse = false && value; /* NOT sketchy */
var alwaysTrue = true || value; /* NOT sketchy */

var sketchyFalse = value && false; /* sketchy */
var sketchyTrue = value || true; /* sketchy */

declare const ww: {is?: ?({a: number} | number)};
var {is} = ww;
if (is && is.a) { }

declare const hh: {a: unknown};
if (hh.a && hh.a.b) { }

function singletonBooleanFalse(x: null | false | Array<unknown>) {
  if (x) { /* sketchy boolean */ }
}

function singletonNum0(x: null | 0 | Array<unknown>) {
  if (x) { /* sketchy num */ }
}

function singletonBooleanTrue(x: null | true | Array<unknown>) {
  if (x) { /* NOT sketchy */ }
}

function singletonNum1(x: null | 1 | Array<unknown>) {
  if (x) { /* NOT sketchy */ }
}
