question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeScript not compiling

See original GitHub issue
[Running] ts-node "d:\dropbox\work\dev\yreuq.js\temp-zadfghcabp.typescript"
d:\dropbox\work\dev\yreuq.js\temp-zadfghcabp.typescript:1
(function (exports, require, module, __filename, __dirname) { function isPathEqual(a: number[], b: number[]): boolean {
                                                                                    ^
SyntaxError: Unexpected token :
    at createScript (vm.js:53:10)
    at Object.runInThisContext (vm.js:95:10)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Function.Module.runMain (module.js:605:10)
    at Object.<anonymous> (C:\Users\axefr\AppData\Roaming\npm\node_modules\ts-node\src\_bin.ts:177:12)
    at Module._compile (module.js:571:32)

[Done] exited with code=1 in 1.977 seconds

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
philmuellercommented, Aug 23, 2017

@axefrog: The reason is that the automatically generated temporary file for your unsaved code (tempCodeRunnerFile.typescript) doesn’t end with “.ts”, so ts-node seems to interpret it as JavaScript instead of TypeScript. As a workaround, you can save the file with “.ts” ending or add the following to your user settings:

"code-runner.languageIdToFileExtensionMap": {
  "typescript": ".ts"
}

@formulahendry: I’ve created a corresponding pull request to apply the correct file ending to the default configuration (#166).

0reactions
formulahendrycommented, Aug 24, 2017

That’s cool. Thanks @philmueller !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio not compiling TypeScript - Stack Overflow
My solution was to roll back the .ts file until it compiled (i.e. the timestamps of typescript and javascript files were identical) and...
Read more >
TypeScript Compiling with Visual Studio Code
To generate source maps for your TypeScript files, compile with the --sourcemap option or set the sourceMap property in the tsconfig. json file...
Read more >
TS does not compile .ts files #32326 - microsoft/TypeScript
TS doesn't compile files ... Actual behavior: Nothing happens. .js version is not created. $ npm run tsc > ts2@1.0.0 tsc /Users/ ...
Read more >
Compile TypeScript Project - TutorialsTeacher
As you know, TypeScript files can be compiled using the tsc <file name>.ts command. It will be tedious to compile multiple .ts files...
Read more >
Compiling TypeScript into JavaScript - JetBrains Rider
By default, the built-in compiler does not create source maps that will let you step through your TypeScript code during a debugging session ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found