typescript function parameter type unexpected token :
typescript
Solution
You are trying to include the .ts file directly, and the browser does not understand that. In this case, it balks on the first type definition it encounters, i.e. the semicolon in
`function greeter(person: string) {`
What you need to do is compile the `Scripts/Main.ts` file to a `Scripts/Main.js` file (VS2013 should do this automatically for you), and then include that in the .aspx source code.
To verify this, there should be a `+` sign next to the `Main.ts` file in the solution explorer, and the `Main.js` file should be under that.
Problem
Just following the simplest Typescript tutorial and when it comes to typing a function parameter I'm failing. ``` function greeter(person: string) { return "Hello " + person; } var user = "Jack"; document.body.innerHTML = greeter(user); ``` But when I load the page I'm getting "Unexpected token :" - the browser is trying to parse Javascript? I get that Tyescript will compile down to JS, but I'm missing something here. I'm using Visual Studio 2013, with jQuery.d.ts to type it. The .ts is going through TypeScriptCompile for its build action. Body for the .aspx looks like this: ``` <div> <script src="Scripts/Main.ts"></script> </div> ```