在Angular 2 Typescript中使用flow.js [英] Using flow.js in Angular 2 Typescript

查看:128
本文介绍了在Angular 2 Typescript中使用flow.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将flowjs或ng-flow集成到我的Angular 2应用程序中.

I want to integrate flowjs or ng-flow to my Angular 2 application.

我已经使用

npm install --save-dev @types/flowjs

来自 https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/类型2.0/flowjs

但是当我将其导入组件import { Flow } from 'flowjs';时,控制台抛出错误

But when I import it in my component import { Flow } from 'flowjs'; the console thrown an error

/node_modules/@types/flowjs/index.d.ts' is not a module.

推荐答案

在创建自己的模块之前,我收到此错误,这是由于文件index.d.ts中没有任何导出的类或模块引起的.我查看了存储库,我的猜测是:该错误是由于文件内未导出任何内容而引起的. 但是,与其他定义文件一样,您不需要导入定义,它是全局定义,因此您只需要使用"///ref"运算符将其添加到编译器生命周期中即可. 我没有使用这种新的Typescript定义文件方法(@types),但是有一篇文章很好地解释了如何将其添加到编译器生命周期中:https://stackoverflow.com/a/39132461/5789456

I got this error before when creating my own modules and it was caused when there is nothing exported class or module inside the file index.d.ts. I looked at the repository and my guess is: the error is caused because there's nothing exported inside the file. But as same as other definition files you don't need to import the definitions, it is global definitions, so you just need to add it in your compiler life cycle using the "///ref" operator. I'm not used with this new Typescript definition files approach (@types), but there's a post explaining very well how to add it to your compiler life cycle: https://stackoverflow.com/a/39132461/5789456

这篇关于在Angular 2 Typescript中使用flow.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆