Consider the following type:
type myType = {
a: string,
b: string
}
Let's say, that at one point of my script, a function could take a myType object, but can work with the a property as a number also. To make this new type for my function I could write:
type myNewType = Omit<myType, 'a'> & {
a: string | number
}
Is there any shorter way to write this? I tried with simply extending the base object, like this:
type myNewType = myType & {
a: number
}
but that results in a being identified as string & number instead of string | number.