nightwatch
Version:
Easy to use Node.js based end-to-end testing solution for web applications using the W3C WebDriver API.
23 lines (19 loc) • 416 B
TypeScript
/**
* Merge Objects Array
*
* @example
* // if array
* [{ a: {}, b: {} }, { c: {} }] => { a: {}, b: {}, c: {} }
*
* // if object
* {} => {}
*/
export type MergeObjectsArray<T> = T extends Array<unknown>
? {
[K in keyof T[number]]: T[number][K];
}
: T;
/**
* If the first type is of type `unknown`, change it to the second type.
*/
export type IfUnknown<T, X> = unknown extends T ? X : T;