MoinMoin Logo
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Navigation

  • Start
  • Sitemap

Upload page content

You can upload content for the page named below. If you change the page name, you can also upload content for another page. If the page name is empty, we derive the page name from the file name.

File to load page content from
Page name
Comment

Revision 7 as of 2017-03-27 15:32:48
  • typescript

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

Sample code typescript for browser

npm install -g typescript
npm install -g webpack 

//greeter.html

<!DOCTYPE html>
<html>
    <head><title>TypeScript Greeter</title><meta charset="UTF-8"></head>
    <body>
        <script src="dist/bundle.js"></script>
    </body>
</html>

//lib.ts 
export function getText(){
    return "text";
}

//greeter.ts 
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 
{
    "compilerOptions": {
        "module": "es6",
        "noImplicitAny": true,
        "removeComments": true,
        "preserveConstEnums": true,
        "sourceMap": true
    },
 "files": [ "greeter.ts",  "lib.ts"] 
}

//webpack.config.js 
var path = require('path');

module.exports = {
  entry: ['./greeter.js','./lib.js'],
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist')
  }
};

// build
tsc
webpack --config webpack.config.js 
  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01