Closed Dremora closed 2 years ago
A very good move from TS. But with a very wide impact as well.
There should be some way to keep pieces of the code which is ok with the old behavior intact WithUndefinedOptions<OldType>
, but I've failed to create such generic.
Accepting and merging, but the release will be delayed for a few days until other moving pieces of this package will complete current iteration.
I'm using this library in a project with exactOptionalPropertyTypes enabled.
Unfortunately, currently I can't conditionally pass
undefined
into optional properties. For example, this code doesn't work:This is because with the new flag, TypeScript treats missing properties and
undefined
as semantically distinct, and this library only allows for properties to be missing (but not to be set toundefined
).Read more about the compiler flag in TypeScript 4.4 blog post. The intention is to migrate all type definitions to support this flag: