You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In screeps, there's an object global which can be used to store values globally (i.e. for use from the console). It should be as simple as adding a declare var global:any; in the code, but I'm not sure where it should be put (hence an issue instead of a PR)
The text was updated successfully, but these errors were encountered:
It would likely be more helpful to store a type for global with an interface that promotes extensibility. Importantly, class types will cancel those from .d.ts files out under certain circumstances, so this must be done carefully. I recommend following the extensibility model put forth under #72 for classes, with the interface methodology allowing new information to be added without overwriting the existing ones. A similar model can be used for memory customization, with the added benefit that the user can further constrain the types by redeclaring the interface with a more precise interface later.
global should not be typed by this project. It's unrelated to the Screeps code base, and will only make it more of a pain for users to integrate their own typings.
The global object that currently exists in Screeps is from Node. If you want it typed, you can add it's typings with typings install --save --global "[email protected]", and then extend it in your own code with:
declarenamespaceNodeJS{exportinterfaceGlobal{// whatever you want to add}}
In screeps, there's an object
global
which can be used to store values globally (i.e. for use from the console). It should be as simple as adding adeclare var global:any;
in the code, but I'm not sure where it should be put (hence an issue instead of a PR)The text was updated successfully, but these errors were encountered: