Hello there. I'll keep this as short as possible. I have a "core" project which my games are based off of. This core project has a type called Positions, and it has a similar structure like this:
type Positions = {
loading: {
logo: PosConfig,
progress: PosConfig,
message: PosConfig
},
menu: {
buttons: {
playButton: PosConfig,
customizeButton: PosConfig,
settings: {
general: PosConfig,
user: PosConfig
}
}
},
main: {
hud: {
health: PosConfig,
stamina: PosConfig,
stats: {
distance: PosConfig,
objective: PosConfig
}
}
}
}
In the core, it loads the data from a JSON file (it follows that format), and I can then access it via other this.game.positions.
Now, the actual game imports the core as a module (since multiple games use the same core), and it provides its own positions and resources. Although all the games follow a similar format, some games might have some special animations or elements which require their own positions. For instance, there might be an extra stat in the main hud, so in the JSON file, I could just list it under main.stats.special. My question is, since I am importing the core from another file, how can I add that property for that specific project? I have tried declaration merging, but that hasn't worked. My attempt was like this:
// types.d.ts
declare module "game-core/src/tools" {
type Positions = {
main: {
hud: {
stats: {
special: PosConfig
}
}
}
}
}
This just simply did not do anything.
(Continued in the message below due to character limit)