I am currently working on creating a mapped type that will turn certain properties into optional ones if they can be undefined.
To elaborate, my starting point is a type structured like this:
interface Input {
foo: string;
bar: string | undefined;
baz: number | undefined;
}
The objective is to use a Mapped Type to convert it into the desired structure below:
interface Output {
foo: string;
bar?: string;
baz?: number;
}
All the examples I have come across so far demonstrate making all properties optional, but that's not exactly what I need in this case.