• Search form is empty!

  • 000.2 TypeScript – Visual Studio Code setup

    http://robertdunaway.github.io

    TypeScript code kata list

    All code kata lists

    Smiley face

    000.2 TypeScript – Visual Studio Code setup

    Duration

    10 minutes

    Brief

    Setting up Visual Studio .NET for code katas.

    For more information

    BING/GOOGLE: “TypeScript Visual Studio Code”

    Instructions

    Kata

    Once Visual Studio Code is installed do the following to get ready for TypeScript.

    NOTE: You can perform these tasks to get used to setting up
    TypeScript in VSC but each Code Kata will have files set up and ready
    to go.


    1. Create a working folder and open this folder in VSC.
    2. Create your first TypeScript file named start-up.ts.

    Add the following code to the new start-up.ts file.


    
    class Startup {  
        public static main():number{
            console.log('hello world');
            return 1;
        }
    }
    
    


    To build the project press CTRL + SHIFT + B

    • You will be prompted to set up a Task Runner. Select Task Runner.


    Update the new task.json file. By default a section of code is uncommented. Change the file referenced from “HelloWorld.ts” to “start-up.ts”. Now the project will build and export a file named start-up.js.

    
    {
        "version": "0.1.0",
        // The command is tsc. Assumes that tsc has been installed using npm install -g typescript
        "command": "tsc",
        // The command is a shell script
        "isShellCommand": true,
        // Show the output window only if unrecognized errors occur.
        "showOutput": "silent",
        // args is the HelloWorld program to compile.
        "args": ["start-up.ts"],
        // use the standard tsc problem matcher to find compile problems
        // in the output.
        "problemMatcher": "$tsc"
    }
    
    


    Next

    Take a few minutes and imagine more examples.

    Smiley face

    0 comments:

    Post a Comment