Comments (2)
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.
from screeps-typescript-declarations.
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:
declare namespace NodeJS {
export interface Global {
// whatever you want to add
}
}
from screeps-typescript-declarations.
Related Issues (20)
- RoomPosition.inRangeTo parameter type is too narrow HOT 3
- Issues with RoomVisual HOT 2
- assigning literal values to constants HOT 7
- Room.createFlag and RoomPosition.createFlag return type is number, when it can also be a string of the Flag's name
- RoomVisual constructor
- STRUCTURE_WALL should be 'constructedWall', not 'wall'
- Interfaces instead of declared classes HOT 4
- StructureSpawn.spawnCreep; deprecation of createCreep / canCreateCreep HOT 1
- typings are deprecated HOT 1
- Question - how to make ts-jest happy at test runtime? HOT 1
- Source should be class? HOT 1
- Missing Nuke class
- StructureSpawn should be a class HOT 1
- Room.createFlag definition HOT 1
- Allow typing of default memory objects HOT 5
- nuker added to CONSTRUCTION_COST constant.ts
- Typescript 2 is stable HOT 3
- Creep body part typings suggestion
- creep.room can literally never be undefined but types say it can be HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from screeps-typescript-declarations.