I am searching for a solution how to create two interfaces that have somewhat similar named properties like this:
interface Int1 {
propOne: string;
propTwo?: number;
propThree?: Date;
}
interface Int2 {
propOneIndex: number;
propTwoIndex?: number;
propThreeIndex?: number;
}
You can see that the properties' names in Int2 are extended from Int1 with the postfix "Index". Is there a way to approach this?
I found this answer, where someone uses an enum and key remapping via as but that requires Typescript version ^4.1 which I don't have. I thought there might be a simpler solution as I expect this to be a common use case.