606 B16 lines
Blame
1/**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8/**
9 * Given an object type with multiple keys, produce a type that has either all of the keys non-null, or all the keys undefined
10 * ```
11 * EnsureAssignedTogether<{a: number, b: string}> === {a: number, b: string} | {a?: undefined, b?: undefined}
12 * ```
13 * This is useful for props that need to be provided together.
14 **/
15export type EnsureAssignedTogether<T extends object> = T | {[key in keyof T]?: undefined};
16