Let's consider the following scenario:
export enum EEnv { devint, qa1 };
export type TEnv = keyof typeof EEnv;
export const env:Record<TEnv, {something:number}> = {
devint: {
something: 1,
},
qa1: {
something: 1,
},
}
Now, I aim to generate a dynamic object based on the env
object, as demonstrated below:
export const SAVE_TOKEN: Record<TEnv, string> = {
devint: "SAVE_TOKEN/devint", // derived from "env" key
qa1: "SAVE_TOKEN/qa1", // derived from "env" key
}
Is it possible to define a type in such a way that it would be "SAVE_TOKEN/"+TEnv
instead of just a plain string?