I have a pretty complicated object with multiple properties that I'd like to extend and override a specific property.
interface ComplicatedObject {
propertyOne: string,
propertyTwo: null
}
interface MoreComplicatedObject extends ComplicatedObject {
propertyTwo: string
}
Essentially, objects with the type ComplicatedObject are converted to the MoreComplicatedType by assigning a string value to propertyTwo. I'd like to avoid using a union type on propertyTwo because all calls using propertyTwo assume that it's a string, not a null value, so I'd rather not have to include type checks in every instance where I access propertyTwo.
How can I extend an interface and override the type of an existing property?