opened
axefrog
username_0
```
[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
```
TypeScript not compiling
issue
created
formulahendry
username_1
`temp-zadfghcabp.typescript`: Do you intend to select a piece of code snippet to run?
comment
created
axefrog
username_0
I just made an untitled file (unsaved in a tab), set the language to typescript, pasted some code in, then pressed CTRL+SHIFT+N to run it. Do I need to select it as well?
comment
created
formulahendry
username_1
Got it. So did you try to run the same code (with `ts-node`) in the terminal?
comment
created
philmueller
username_2
@username_0: 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"
}
```
@username_1: I've created a corresponding pull request to apply the correct file ending to the default configuration (#166).
comment
closed
formulahendry
username_1
issue
created
formulahendry
username_1
That's cool. Thanks @username_2 !
comment