= typescript = * https://www.typescriptlang.org * https://www.typescriptlang.org/docs/tutorial.html == install == npm install -g typescript == Compile == tsc helloworld.ts == kate == https://github.com/PrettyFlower/KateTypeScriptSyntaxHighlighting {{{ wget https://github.com/PrettyFlower/KateTypeScriptSyntaxHighlighting/raw/master/typescript.xml cp typescript.xml /usr/share/apps/katepart/syntax/typescript.xml }}} With let keyword added {{{#!highlight xml if else for in while do continue break with try catch finally switch case new var function return delete true false void throw typeof const default this null undefined class export declare module import static interface implements constructor public private string number bool any extends let }}} == Sample code typescript for browser == {{{#!highlight bash npm install -g typescript npm install -g webpack }}} === greeter.html === {{{#!highlight html TypeScript Greeter }}} === lib.ts === * https://www.typescriptlang.org/docs/handbook/modules.html Any declaration (such as a variable, function, class, type alias, or interface) can be exported by adding the export keyword. {{{ export function getText(){ return "text"; } }}} === greeter.ts === * import xyz from "module"; {{{ import {getText} from "./lib"; interface Person { firstName: string; lastName: string; } function greeterPerson(p:Person) { return "Hello GP, " + p.firstName + ' ' + p.lastName + ' ' + getText() ; } function greeter(person:string) { return "Hello, " + person; } var user = "XPTO User"; //document.body.innerHTML = greeter(user); document.body.innerHTML = greeterPerson( {firstName:"First",lastName:"Last"} ); }}} === tsconfig.json === {{{#!highlight javascript { "compilerOptions": { "module": "es6", "noImplicitAny": true, "removeComments": true, "preserveConstEnums": true, "sourceMap": true }, "files": [ "greeter.ts", "lib.ts"] } }}} === webpack.config.js === {{{#!highlight javascript var path = require('path'); module.exports = { entry: ['./greeter.js','./lib.js'], output: { filename: 'bundle.js', path: path.resolve(__dirname, 'dist') } }; }}} === build === {{{#!highlight bash tsc webpack --config webpack.config.js }}}