TypeScript [examples]

TypeScript type checking is great for detecting incorrect property and method usage at compile time but for global variables that are dynamically created it can get in the way and report compile time errors.

To work around the ability to use global variables you can declare them using declare var, e.g.

/// <reference path="../../library/Lianja.d.ts" />
//------------------------------------------------

//
// Lianja custom TypeScript section "page1_section1"
//
// need to declare variables for type checking
declare var returnvalue: Lianja.Section;
declare var oSection: Lianja.Section;
declare var ocont: Lianja.Container;

// now create the UI hierachy
oSection = createObject("oSection", "section");
oSection.addobject('ocont','container');
ocont.backcolor = "orange";

// need to set returnvalue to the object created
returnvalue = oSection;

Advertisements

TypeScript

if you are doing JavaScript programming, you will do yourself a favor by moving to Typescript. All your JavaScript will still run, but you will gain modern programming features that will help your development.

The best part is that Lianja handles your Typescript compilation behind the scene, so there’s no drag on your development.

And to top it off, there is a very good book (from what reviewers write about it) available for free on Github: https://github.com/basarat/typescript-book

What turned out to suit me best, however, was the TypeScript Handbook (click on Handbook to see and reach the Chapters), which has all the examples I need and moves right along.


You can write in typescript using plain JavaScript. It is automatically compiled for you by Lianja.


We include TypeScript definition files for “Lianja” and the “Lianja Framework”.

It is a very nice language indeed for building enterprise business apps..

There is a good handbook at:
https://www.typescriptlang.org/docs/…sic-types.html

The benefits of TypeScript are that it is a modern OO scripting language with a high degree is compatibility with ES6 (EcmaScript 2015) but it can be transpiled (as Lianja does for you) into ES5 which is compatible with all current browsers.

Lianja transpiles TypeScript files into JavaScript behind the scenes and in fact will soon be handling jsx files (in the form of TypeScript .tsx files) . This will provide you with the ability to write custom WebViews using React and React-Native.