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 had the same problem (Here is it solved). I put the step by step how i solved it here.
Install Parse component 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 parsemodule 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.com/DefinitelyTyped/tsd
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With