我是如何在外部模块中访问此静态属性的? game.ts中的类Game包含实际的静态属性,但Game不能访问模块GameObjects
///<reference path="game.ts" />
export module GameObjects {
export class Player implements GameObject {
color: string = Game.staticProperty;
etc
答案 0 :(得分:1)
如果要从此样式的模块导出类,则需要像这样导入:
game.ts
export class Game {
public static staticProperty = "Test";
}
player.ts
import game = module("game");
export class Player {
public example = game.Game.staticProperty;
}
这也将生成require
语句以便为您加载模块。