Here is a scenario to consider:
The situation at hand entails having the following:
type A = {
a: number | undefined
b: string
}
// The desired outcome is for a helper type that transforms it into
type B = {
a: number| null
b: string
}
type A = {
a: number | null
b: string
}
// And here, we want a helper type that converts it back to its original form
type B = {
a: number| undefined
b: string
}
Is there a method to achieve this conversion? Attempts have been made to search online with limited success in finding relevant resources. It is crucial not to introduce null
, but rather replace undefined with null. Additionally, is there another helper type capable of reverting this transformation?