【问题标题】:Importing gridster TypeScript definitions导入 gridster TypeScript 定义
【发布时间】:2018-05-30 14:17:00
【问题描述】:

我开始了一个新的 ionic 项目,并在项目根目录中安装了 gridster.js 和 npm install gridster 和 npm install @types/jquery.gridster。但我无法导入已安装的定义。我正在使用以下语句:

import { Gridster } from '@types/jquery.gridster';

我认为这个 import 语句应该有效,但它没有。 VScode 告诉我/home/user/git/Project/node_modules/@types/jquery.gridster/index.d.ts" 不是模块,但我还应该导入什么?

gridster/ 和 @types/jquery.gridster/ 也存在于我的项目 node_modules/ 目录中。

【问题讨论】:

    标签: cordova typescript ionic-framework typescript-typings gridster


    【解决方案1】:

    gridster 类型是全局的。您应该不需要任何导入来获取它们:

    // @ts-check
    
    /** @type {Gridster} */
    const g = {};
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-10
      • 2017-02-02
      • 2017-09-14
      • 2019-04-30
      • 1970-01-01
      • 2017-07-21
      • 2016-08-17
      • 2017-02-10
      相关资源
      最近更新 更多