ses
ses

Reputation: 13352

Unexpected Identifier in Typescript Interface in chrome

I'm trying to understand why I'm having Unexpected Identifier error in Typescript (1.4) Interface in chrome

The code:

interface IMessage {
    target : string;
    type : string;
    data : Object;
}

enter image description here

I wonder maybe it is *.js.map file generated incorrectly. I use last WebStorm to generate them. The Imessage.js.map for that consists with that that content:

{"version":3,"file":"IMessage.js","sourceRoot":"","sources":["IMessage.ts"],"names":[],"mappings":"AAIC"}

enter image description here

IMessage.js

//# sourceMappingURL=IMessage.js.map

Upvotes: 4

Views: 8897

Answers (1)

Dick van den Brink
Dick van den Brink

Reputation: 14557

From the looks of it, you are loading your TypeScript code .ts in Chrome while you should load your .js files.

When you write TypeScript files you can compile them with the compiler (tsc) and it outputs .js file which you can load in the browser nodejs or other JavaScript compatible stuff!

Upvotes: 1

Related Questions