Skip to content

Instantly share code, notes, and snippets.

@elshanx
Created October 13, 2021 18:00
Show Gist options
  • Save elshanx/c727ff2e7362c723b1273c4449ef5038 to your computer and use it in GitHub Desktop.
Save elshanx/c727ff2e7362c723b1273c4449ef5038 to your computer and use it in GitHub Desktop.
ts utils
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never }
export type XOR<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment