0

I'm trying to use the typescriptServices.d.ts and typescriptServices.js that from built\local after running jake local. I'm trying to use them in a Node.js app, but I'm getting confused how to require them.

1: Module cannot be aliased to a non-module type.

enter image description here

2: Duplicate identifier 'TypeScript'.

enter image description here

3: Compiles & Runs, but missing IntelliSense

If I wrap the code in an export function it compiles and runs, but I have to comment out var TypeScript = require('./typescriptServices'); in order for IntelliSense to work. Bug in IntelliSense?

enter image description here

4: Use aliases as workaround

This restores IntelliSense in the function, but IntelliSense doesn't work when writing the import statement unless I comment out the require line.

enter image description here

Code is from TypeScript: get syntax tree.

Community
  • 1
  • 1
Cameron Taggart
  • 5,771
  • 4
  • 45
  • 70

1 Answers1

3

The typescript compiler api / or / language service is not readily consumable from node.js

You can how ever open it up yourself like someone already did for the Compiler API : https://stackoverflow.com/a/23956556

Community
  • 1
  • 1
basarat
  • 261,912
  • 58
  • 460
  • 511
  • 1
    It could definitely be made easier. I did get it working, but had to jump through a couple of hoops to keep the `var TypeScript` and `TypeScript` namespace from conflicting. http://blog.ctaggart.com/2014/06/typescript-ast-from-nodejs.html – Cameron Taggart Jun 04 '14 at 05:05