【问题标题】:ag-grid with typescript 3.9 - getting build error带有 typescript 3.9 的 ag-grid - 出现构建错误
【发布时间】:2020-11-06 15:00:35
【问题描述】:

编译失败并出现以下错误:

ERROR in ../node_modules/ag-grid-community/src/ts/headerRendering/horizontalResizeService.ts:58:52 - error TS2551: Property 'msUserSelect' does not exist on type 'CSSStyleDeclarati
on'. Did you mean 'userSelect'?

58         this.oldMsUserSelect = this.eGridDiv.style.msUserSelect;
                                                      ~~~~~~~~~~~~

  ../node_modules/typescript/lib/lib.dom.d.ts:3057:5
    3057     userSelect: string;
             ~~~~~~~~~~
    'userSelect' is declared here.

【问题讨论】:

    标签: typescript ag-grid


    【解决方案1】:

    问题是在 TS 3.9 all properties of CSSStyleDeclaration like msUserSelect were "unprefixed" 开始时。

    我的解决方法是“返回”丢失的属性:

    // remove this after ag-grid will get support of TS 3.9
    declare global {
        interface CSSStyleDeclaration {
            msUserSelect: string;
            msOverflowStyle: string;
        }
    }
    Object.defineProperty(CSSStyleDeclaration, "msUserSelect", {
        get: function getter() {
            return this.userSelect;
        }
    });
    Object.defineProperty(CSSStyleDeclaration, "msOverflowStyle", {
        get: function getter() {
            return this.overflowStyle;
        }
    });
    

    我希望它对某人有所帮助... :)

    【讨论】:

      猜你喜欢
      • 2016-11-04
      • 2021-03-31
      • 2016-05-06
      • 2017-01-22
      • 2020-05-08
      • 2020-04-21
      • 2017-09-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多