Referencing Another TypeScript Project?

Topics: General
May 18, 2014 at 12:36 PM
Edited May 18, 2014 at 12:51 PM
Hello Community,

I am looking to create a TypeScript Class Library that I can use to reference in my TypeScript HTML Application (or NodeJS Application through the use of NodeJS Tools). What is the best way of going about this?

Thank you,
Michael
May 18, 2014 at 2:47 PM
Edited May 18, 2014 at 2:52 PM
There is no explicit support for what you require at present.

The closest solution that I can think of is to
  • Use internal modules
  • Combine files into a single output file
  • Ensure the "Generate declarations files" is checked.
  • In the HTML Application, add a <reference> tag to the generated .d.ts file.
This will only work for HTML Applications (i.e. code rendered by a browser), and you will have to take responsibility for loading the library script yourself (via a <script> tag). For Node JS applications you will have to look at creating a private NPM or some mechanism for copying the library into the node_modules folder.

See also:

Work Items

TypeScript Library project type in Visual Studio
Please provide a "TypeScript Class Library" project template

Discussions

We're searching a good workflow for our typescript project. Which approaches do you use?
Typescript libraries
Marked as answer by MichaelDBang on 5/18/2014 at 8:02 AM
May 18, 2014 at 2:50 PM
OK, great nabog, thank you for your patience, reply, and suggestion. I have voted for these items. There is obviously still a long road ahead.