Created
September 16, 2023 13:01
Utility Typescript Type to know when exactOptionalPropertyTypes is set
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Doesnt work past Typescript 4.6, but is easily replaced by