将非打字稿 npm 包 (pondjs) 与来自打字稿文件的 Meteor 一起使用
Using non-typescript npm package (pondjs) with Meteor from typescript files
我将 Pondjs 库添加到我的项目中:
meteor npm install --save pondjs
但我不知道如何在我的 Typescript 文件中使用它,
To use it within a browser you will need to install it with npm and then build your source with Webpack, Browserify or something similar.
但是由于我使用的是 (Angular2-)Meteor,所以我无法使用 Webpack 或 Browserify。
我尝试导入为:
import 'pondjs'; // no complaint about import
declare var Index: any;
let index = new Index("1d-12345"); //but: Can't find variable: Index
还有:
import * as something from 'pondjs'; // cannot find module 'pondjs'
事实证明打字稿编译器找不到模块,因为没有打字。但是该包仍然可以与 ES6 导入一起使用:
import {Index, TimeSeries} from "pondjs";
Meteor 会找到包并将其发送到浏览器。因此,请忽略编译器错误或编写类型。
我将 Pondjs 库添加到我的项目中:
meteor npm install --save pondjs
但我不知道如何在我的 Typescript 文件中使用它,
To use it within a browser you will need to install it with npm and then build your source with Webpack, Browserify or something similar.
但是由于我使用的是 (Angular2-)Meteor,所以我无法使用 Webpack 或 Browserify。
我尝试导入为:
import 'pondjs'; // no complaint about import
declare var Index: any;
let index = new Index("1d-12345"); //but: Can't find variable: Index
还有:
import * as something from 'pondjs'; // cannot find module 'pondjs'
事实证明打字稿编译器找不到模块,因为没有打字。但是该包仍然可以与 ES6 导入一起使用:
import {Index, TimeSeries} from "pondjs";
Meteor 会找到包并将其发送到浏览器。因此,请忽略编译器错误或编写类型。