Default to null and default to undefined
Hello
Thank you for this awesome library, it's the best Maybe library for typescript I've ever seen. I discovered one issue though when introduced it to our codebase.
All nullable objects have type T | undefined | null, but many libraries use only one nullable values either null or undefined (all optional fields have type T | undefined).
Basically resolving this is quite straightforward, you just need default to some value, like withDefault(undefined, nullable) or withDefault(null, nullable). But use these all the time in the client code looks dirty. Maybe there can be some helpers in the library to resolve this library. Something like:
withDefaultUndefined<T>(nullable: Nullable<T>): T | undefined;
withDefaultNull<T>(nullable: Nullable<T>): T | null;
I can create a PR myself if you ok with that
Hello @denistakeda! Thanks for bringing this up. Feel free to open an PR. Some unit test coverage on the new functions would be great too if you don't mind 😀