I\'m interested in defining an existing framework (openlayers.d.ts) but cannot figure out how to express the fact that OpenLayers.Layer is both a class and a namespace for O
You can use namespace/class merging to get an equivalent effect to nested classes. This example is adapted from Chapter 1 of Pro TypeScript.
You perform merging with a class and a namespace, or with a function and a namespace.
In all cases, the namespace must appear after the class or function for the merge to work.
Adapted example:
class Outer {
}
namespace Outer {
export class Mid {
}
export module Mid {
export class Inner {
}
}
}
var a = new Outer();
var b = new Outer.Mid();
var x = new Outer.Mid.Inner();