admin管理员组文章数量:1415697
I am new to Angular2 and TypeScript and I am trying to import Parse into my application. So I have installed parse as a node module using npm install parse --save
and I can see the parse folder inside the node_modules
folder.
Now, in my app.ts file, I am trying the following code but I don't know why is this giving errors.
import {Parse} from 'parse';
It gives the error that it
cannot find the module 'parse'
.
I also tried the following code,
import {} from 'parse'
and it works without errors but I don't know how do I use the Parse object now.
Any help or suggestion is highly appreciated.
Thanks in advance.
I am new to Angular2 and TypeScript and I am trying to import Parse into my application. So I have installed parse as a node module using npm install parse --save
and I can see the parse folder inside the node_modules
folder.
Now, in my app.ts file, I am trying the following code but I don't know why is this giving errors.
import {Parse} from 'parse';
It gives the error that it
cannot find the module 'parse'
.
I also tried the following code,
import {} from 'parse'
and it works without errors but I don't know how do I use the Parse object now.
Any help or suggestion is highly appreciated.
Thanks in advance.
Share Improve this question asked Sep 19, 2016 at 20:37 Samarth AgarwalSamarth Agarwal 2,1448 gold badges42 silver badges81 bronze badges 2-
included
parse
js in html , ryt? – Ajay Narain Mathur Commented Sep 19, 2016 at 20:40 - No, could you please tell me what should be the path of the src, I have tried ../node_modules/... but not working. – Samarth Agarwal Commented Sep 19, 2016 at 20:49
2 Answers
Reset to default 5I had the same problem (Here is it solved). I put the step by step how i solved it here.
Install Parse ponent to the project
npm install parse --save
Install Parse types
npm install @types/parse --save
import Parse module
const Parse: any = require('parse');
use Parse module
Parse.initialize("key"); ...
Hope it helps;)
You need to declare the parse
module so that is recognized by typescript.
You can declare the parse
module yourself with something like this:
declare module 'parse' {
var parse: any;
export { parse };
export default parse;
}
Or you can use the typing definitions provided by Definitely Typed: https://github./DefinitelyTyped/tsd
本文标签: javascriptUsing Parse as a module in Angular2Stack Overflow
版权声明:本文标题:javascript - Using Parse as a module in Angular2 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745237501a2649122.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论