In order to ensure that an enum definition is always passed, I am looking to create an interface with a specific requirement.
// msg.ts, showing an example enum called Messages
export enum Messages {
A,
B
}
// interfaces.d.ts
export interface IThingy {
Messages: Messages
// ^ how can I specify that Messages must be the entire enum, not just a member of it?
}
I want users to have seamless access to this enum as if it were injected. For instance:
function (param: IThingy) {
param.Messages.A // works fine!
}
If direct injection is not feasible, what other method could I employ to achieve the same outcome? Ultimately, my goal is to pass around a constant, strongly-typed key-value (string:string) map.
I came across a similar discussion on Stack Overflow, but my intention here is quite distinct.