I am currently in the process of converting a Coffeescript application to Typescript. I have come across a coffeescript-to-typescript tool that is supposed to simplify this task. However, I am facing difficulties getting it to work properly and the error messages seem quite absurd...
Here is an example of a Coffeescript file:
CoreModule.service('FileRequire', [
# dependencies
() ->
@resolver = (subdirectory, extension) ->
(pathcode) ->
tmp = pathcode.split ':'
modules = tmp[0]
file = tmp[1]
'app/modules/' + modules.split('/').join('/modules/') + '/' + subdirectory + '/' + file + '.' + extension
return
])
When I attempt to execute it on my Windows machine with the globally installed typescript
and coffeescript-to-typescript
modules using the following command:
C:\development\mp-frontend>coffee-to-typescript -cma app\modules\core\services\FileRequire.coffee
error compiling app\modules\core\services\FileRequire.coffee
app\modules\core\services\FileRequire.coffee:4:6: error: unexpected TERMINATOR
@resolver = (subdirectory, extension) ->
^
1 files failed
and
C:\development\mp-frontend>coffee-to-typescript -c app\modules\core\services\FileRequire.coffee
Error: spawn tsc ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1046:32)
at child_process.js:1137:20
at process._tickCallback (node.js:355:11)
Could someone please shed some light on what might be causing these issues? The TERMINATOR
error appears to be a common problem with Coffeescript, even though the code compiles successfully with Grunt and functions perfectly fine (considering it ultimately transpiles to Javascript).
At this point, the tool seems rather ineffective... any guidance on where I might be going wrong would be greatly appreciated.