I’m trying to import the code inside this file in my TypeScript app:
However, when I try to compile this file, there is no output js file generated nor do I get any warnings.
Ideas?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You are compiling a declarations file which contains only types used by Typescript.
Mongodb.tsis used as a a representative for thejavascriptcode that will take care of the connection to mongodb. The intention here clearly is to usemongodb.tsas a stub in order for the compiler to be able to typecheck code that uses mongodb. In your code, you have to loadmongodb.tsas an external module and then program against it. At runtime, for instance innodejs, a different module that contains the “productive” javascript code will be loaded. As an example, you can use the following code in your app:myapp.ts
This is taken from one of the examples at codeplex. Once again, in order to run this you need to have a runtime environment that provides an implementation of mongodb.