Hi, I'm a fan of the game! I wanted to contribute. I looked into adding production tooltips for manufactured goods (plywood etc). But I'm struggling to understand the code. So instead... would you be interested in a series of patches to add type information to the codebase?
These changes would:
Be non-functional. No behaviour changes for end users
Avoid implementation changes. For example, vars.js modifies the global object incrementally in-place. This is hard to model with types. But these patches won't change the code, only add types. If typing vars.js proves too complex, I'd skip typing it.
Types can be added with JSDoc and checked with the Typescript compiler. Type issues would show up to developers in their editor. Example:
// Minimal typing
/**
* @param {number} min
* @param {number} max
* @returns {number}
*/
Math.rand = function(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
// Optionally, write comments
/**
* Generate a random number between `min` and `max` inclusive
* @param {number} min Minimum value to generate
* @param {number} max Maximum value to generate
* @returns {number} Random number generated
*/
Math.rand = function(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
Let me know if this interests you. These patches would be hundreds+ lines, so I don't want to start work unless you're interested 🙏
Hi, I'm a fan of the game! I wanted to contribute. I looked into adding production tooltips for manufactured goods (plywood etc). But I'm struggling to understand the code. So instead... would you be interested in a series of patches to add type information to the codebase?
These changes would:
vars.js
modifies theglobal
object incrementally in-place. This is hard to model with types. But these patches won't change the code, only add types. If typingvars.js
proves too complex, I'd skip typing it.Types can be added with JSDoc and checked with the Typescript compiler. Type issues would show up to developers in their editor. Example:
Let me know if this interests you. These patches would be hundreds+ lines, so I don't want to start work unless you're interested 🙏