Giter Site home page Giter Site logo

Comments (2)

Dessix avatar Dessix commented on July 29, 2024

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.

bryanbecker avatar bryanbecker commented on July 29, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.