I have this interface:
interface IInternalListener {
element: HTMLElement,
id: string,
type: string,
listener: EventListenerOrEventListenerObject,
useCapture: boolean
}
And I also want to use this interface:
interface IListener {
element: HTMLElement,
id: string | number,
type: string,
listener: EventListenerOrEventListenerObject,
useCapture: boolean
}
The only difference being the type for id. I want to employ DRY (Don't Repeat Yourself)
How can I create this without copy paste. A mapped type seems the way to go but in this answer here they are mapping all the props - Typescript: how do you create a Copy of a type but change the property typeings
I only want to change one prop. Anyone know how to do this? I don't have to use mapped types, any viable solution is fair game. TIA