Any way to declare a nest class structure in typescript?

前端 未结 6 1966
盖世英雄少女心
盖世英雄少女心 2020-12-05 06:35

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

6条回答
  •  庸人自扰
    2020-12-05 06:48

    Use TypeScript's class expressions for this:

    var OpenLayers = class {
        static Layer = class {
            static Markers = class {}
        }
    }
    

提交回复
热议问题