Reputation:
working fiddle. http://jsfiddle.net/46aqscwv/
breaking fiddle http://jsfiddle.net/Ls1aqLv1/
error
Uncaught SyntaxError: Unexpected token (
at new Function (<anonymous>)
at exec (typescript.js:41)
at HTMLDocument.runScripts (typescript.js:41)
code
function WholeUI() {
$(document).ready(function() {
$('ul.tabs li').click(function() {
var tab_id = $(this).attr('data-tab');
$('ul.tabs li').removeClass('current');
$('.tab-content').removeClass('current');
$(this).addClass('current');
$("#" + tab_id).addClass('current');
})
Upvotes: 0
Views: 195
Reputation: 8277
Seems like for some reason JSFiddle can't transpile your Typescript code into a working Javascript code. In particular this part of your code (in typescript):
users.map(u => ({ FileName: u.login }))
is transpiled into this (javascript with wrong syntax):
users.map(function (u) ({ FileName: u.login }))
Modifying the arrow function gets rid of the error (typescript and javascript):
users.map(function (u) { return ({ FileName: u.login }) })
Another problem is you are not calling the WholeUI
function. You can see a working example here.
Upvotes: 5
Reputation: 155792
Fiddle's aren't terribly good for editing TypeScript code, as they don't give particularly useful errors when the syntax is invalid.
Instead try using an editor like VS Code - opening this as a .ts
file in any such editor finds numerous errors, including undeclared variables (pai_to_delete
) and missing type definitions for jQuery, kendoWindow and Rx.
Upvotes: 2