Is it possible to eliminate generics from an interface?
Sample code:
This is what I currently have:
interface ServerMessages {
[ActionType.EVENT_1]: ResponseEventBody1;
[ActionType.EVENT_2]: ResponseEventBody2;
[ActionType.EVENT_3]: ResultModifier<ResponseEventBody3>;
[ActionType.EVENT_4]: ResponseEventBody4;
[ActionType.EVENT_5]: ResultModifier<ResponseEventBody5>;
[ActionType.EVENT_6]: ResultModifier<ResponseEventBody6>;
[ActionType.EVENT_7]: ResponseEventBody7;
}
interface ResultModifier<T> {
success: boolean;
payload: T;
error?: SomeError;
}
This is the desired outcome:
interface ServerMessagesWithoutGenerics {
[ActionType.EVENT_1]: ResponseEventBody1;
[ActionType.EVENT_2]: ResponseEventBody2;
[ActionType.EVENT_3]: ResponseEventBody3;
[ActionType.EVENT_4]: ResponseEventBody4;
[ActionType.EVENT_5]: ResponseEventBody5;
[ActionType.EVENT_6]: ResponseEventBody6;
[ActionType.EVENT_7]: ResponseEventBody7;
}
I've already spent 3 hours searching for a solution without any luck. Any help would be greatly appreciated.