diff --git a/src/types/Prettify.type.ts b/src/types/Prettify.type.ts new file mode 100644 index 0000000..9012eab --- /dev/null +++ b/src/types/Prettify.type.ts @@ -0,0 +1,7 @@ +/** + * Resolve mapped types and show the derived keys and their types when hovering in + * VS Code, instead of just showing the names those mapped types are defined with. + */ +export type Prettify = { + [K in keyof T]: T[K] +} & {} diff --git a/src/types/Xor.type.ts b/src/types/Xor.type.ts index 32bb07d..2494b8b 100644 --- a/src/types/Xor.type.ts +++ b/src/types/Xor.type.ts @@ -1,3 +1,4 @@ +import { Prettify } from './Prettify.type' import { Without } from './Without.type' /** @@ -11,5 +12,5 @@ import { Without } from './Without.type' * More: https://github.com/maninak/ts-xor/tree/master#description */ export type XOR = (T | U) extends object - ? (Without & U) | (Without & T) + ? (Prettify & U>) | (Prettify & T>) : T | U