/**
 * Copyright 2018-present Facebook.
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 * @format
 */

// Typescript doesn't know Array.filter(Boolean) won't contain nulls.
// So use Array.filter(notNull) instead.
export function notNull<T>(x: T | null | undefined): x is T {
  return x !== null && x !== undefined;
}

Add notNull filter with type guard
Add notNull filter with type guard

Summary: You need to use a type guard when narrowing types in a filter.

Reviewed By: danielbuechele

Differential Revision: D17163782

fbshipit-source-id: aa78bdd392653ebf1080a04e62e131b607e5181b
