Reputation: 5987
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
Upvotes: 1
Views: 270
Reputation: 2901
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.
Upvotes: 2