I just started learning native-script framework and I'm following the "Get Started with JavaScript" tutorial from the official website. I have a background in Java so I'm more familiar with typescript. I tried to replace all JavaScript code to the typescript equivalent.
So far everything is OK, but when I reached Chapter three > 3.4: Adding a view model section , I got confused on how to implement the Observable in typescript. this is the code from the website:
var observableModule = require("data/observable");
var user = new observableModule.fromObject({
email: "[email protected]",
password: "password"
});
And this is what I came up with:
import {Observable} from 'data/observable';
class User extends Observable {
email = "[email protected]";
password = "password";
}
let user = new User();
When I tested it, it seems to work. Are the above codes equivalent or did I miss something?