0

Any ideas how I can access this static property in a external module? The class Game in game.ts contains the actual static property but Game is not accessable to the module GameObjects

///<reference path="game.ts" />

    export module GameObjects {



    export class Player implements GameObject {

        color: string = Game.staticProperty;
etc
Nikos
  • 7,295
  • 7
  • 52
  • 88

1 Answers1

1

If you are exporting classes from modules in this style, you'll need to import like this:

game.ts

export class Game {
    public static staticProperty = "Test";
}

player.ts

import game = module("game");

export class Player {
    public example = game.Game.staticProperty;
}

This will also generate the require statement to load the module for you.

Fenton
  • 241,084
  • 71
  • 387
  • 401