http://robertdunaway.github.io
TypeScript code kata list
All code kata lists
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
Install Visual Studio Code. This is a free version of Visual Studio 2015.
https://code.visualstudio.com/
Install NodeJS
https://nodejs.org/en/
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.
- Create a working folder and open this folder in VSC.
- 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.
0 comments:
Post a Comment