1

I'm using EddyVerbruggen's Firebase plugin(https://github.com/EddyVerbruggen/nativescript-plugin-firebase) in one of my NativeScript application.

Also, I'm the first time using TypeScript in this project. I've setup everything as it's given in their documentation. But, can't able to understand how to use their code in TypeScript.

Ex:

 var firebase = require("nativescript-plugin-firebase");

  firebase.init({
    persist: true // Allow disk persistence. Default false.
  }).then(
      function (instance) {
        console.log("firebase.init done");
      },
      function (error) {
        console.log("firebase.init error: " + error);
      }
  );

Can't able to understand how to use above code in Typescript. Any documentation or tutorial link will be a great help.

Regards

1
  • 2
    What's the problem? All JS code should work fine in Typescript as it's a superset. If you just want some general info on using Typescript and Nativescript together, then I'll post an answer with that info. Commented Jun 1, 2016 at 11:08

1 Answer 1

2

All JavaScrip is valid TypeScript, there is not need for any additional changes. The above JavaScript calls are 100% valid in TypeScript and should not lead to any errors or warnings.

Here is a quick quote from www.typescriptlang.org:

Types enable JavaScript developers to use highly-productive development tools and practices like static checking and code refactoring when developing JavaScript applications.

Types are optional, and type inference allows a few type annotations to make a big difference to the static verification of your code.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.