Use of fat arrow functions in JSFiddle with TypeScript

I've had some snippets on JSFiddle for some blog posts using TypeScript, but some of them have stopped working.

Specifically it's when I use the fat arrow notation for function definitions. It have been working before, so maybe I need to set some options on JSFiddle?

Here is a simple example: https://jsfiddle.net/CaveOfCode/3wdme693/1/ With the following snippet:

const fatArrow = () => console.log("fatArrow");
fatArrow();
const functionKeyword = function() { console.log("functionKeyword"); };
functionKeyword();

The fatArrow throws the error.

VM111:2 Uncaught SyntaxError: Unexpected identifier

Upvotes: 2

Views: 313

Answers (1)

basarat
basarat

Reputation: 276105

Their TypeScript integration is broken as you can see on the console

enter image description here

Worth contacting them through different channels : http://doc.jsfiddle.net/meta/channels.html

Your code is correct (as you probably know).

Upvotes: 4

Related Questions