TypeScript

Ref: https://www.typescriptlang.org/docs/tutorial.html
Installation:

  1. Install from npm

    Check the typescript version:

     
  2. Try it via Visual Studio Code.
    Create a new file ‘greeter.ts’ and here is the content:

    Then compile it via

    It’d create a new js file: greeter.jsgreeter.js has same content with greeter.ts.
  3. TypeScript Interface
    Create a new file ‘greeter-interface.ts’:

    Then compile it

    Here is the output ‘greeter-interface.js’

  4. TypeScript Class
    Create a new file ‘greeter-class.ts’:

    Then compile it

    Here is the output ‘greeter-class.js’

  5. Open it on your web browser
    Create a new file ‘greeter.html’

    Then open the html file on your browser. It’d show like this:

     

Leave a Reply

Your email address will not be published. Required fields are marked *