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