Convert from Javascript to Typescript -


how convert function javascript typescript?

var toggleswitch = this.toggleswitch || (function () { //code } 

i know var toggleswtich part can written export class toggleswitch {}, i'm not sure rest of line.

if write module, you'll end identical code...

module toggleswitch {  } 

modules can extended in typescript. difference compiler know whether module declared or not, saves test.

to take example further, here example toggleswitch declared twice, different contents. you'll notice can access contents. can split across multiple files:

module toggleswitch {     export class {         go() {             alert('a');         }     } }  module toggleswitch {     export class b {         go() {             alert('b');         }     } }  var = new toggleswitch.a(); var b = new toggleswitch.b();  a.go(); b.go(); 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -