如何在window上挂载全局属性

TT / 2023-07-27 / 原文

创建一个 global.d.ts

import * as C from "cesium";

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