blob: 4cb85aae9dac02bed01e85186de4c04bdd26b1cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
/**
* Determine if {@linkcode input} matches the `"object"` type
*/
export function isObject(input: unknown): input is object {
return typeof input === 'object' && !!input;
}
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
/**
* Helper type for creating an exclusive union between two types
*
* @see {@link https://stackoverflow.com/a/53229567/2250435 | StackOverflow Post}
*/
export type XOR<T, U> = T | U extends object
? (Without<T, U> & U) | (Without<U, T> & T)
: T | U;
|