Skip to content

Instantly share code, notes, and snippets.

@vjau
Created September 16, 2023 13:01
Show Gist options
  • Save vjau/f136c9ff37591cc853faf5a43025db7a to your computer and use it in GitHub Desktop.
Save vjau/f136c9ff37591cc853faf5a43025db7a to your computer and use it in GitHub Desktop.
Utility Typescript Type to know when exactOptionalPropertyTypes is set
type _Intersect = {a?:number} & {a:number|undefined};
//state of exactOptionalPropertyTypes
type IsExactOptional = _Intersect["a"] extends Exclude<_Intersect["a"], undefined> ? true : false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment