如何在window上挂载全局属性

创建一个 global.d.ts

import * as C from "cesium";

// 扩展全局变量
declare global {
    // 定义全局Cesium类型
    const Cesium: typeof C;
    // 允许扩展 Window
    interface Window {
        Cesium: typeof C;
    }
}

 

posted @ 2023-07-26 23:59  邢韬  阅读(145)  评论(0编辑  收藏  举报