TypeScript Projects?

Topics: General
Dec 18, 2012 at 11:18 AM

Hello Community,

I am investigating TypeScript, and I'm curious about the overall vision for a development paradigm.

To me, when I think of a TypeScript application, I would like to think of it as a set of TypeScript projects in Visual Studio that operate and function precisely as a set of C# projects do.  That is, I open Visual Studio, and Create New Project --> New TypeScript project.

These projects would then compile to the expected JavaScript files upon compile.

Is this how it operates?  If not, are there plans to make it this way?  I have been digging around and I cannot find any of this functionality currently.  Maybe I'm looking in the wrong place.

Any guidance would be appreciated!

Thank you,

Michael

Dec 18, 2012 at 11:46 AM

This is pretty much how it works right now. I literally open VS, create a new Solution, add a TypeScript project and then start coding. Sometimes you will need to manually tweak the project file (or use the free VS extension MS provides) or create a custom build action, but basically what you've described here is the process I go through every day. Unless there was something further you were expecting?

Dec 18, 2012 at 11:49 AM

Hmmmm... Maybe my install is horked.  I do not see a TypeScript Project in my Add New Project dialog.  Is it under Visual C#?  Or perhaps I don't have something obvious installed?  I installed the latest version of this:

http://www.microsoft.com/en-us/download/details.aspx?id=34790

Dec 18, 2012 at 11:51 AM

This is what I see for a Add New Project dialog:

 

Dec 18, 2012 at 11:52 AM

New Project -> Installed -> Templates -> Other Languages -> Visual C# -> then pick "HTML Application with TypeScript"

I know, I know. It makes no sense at all to have it under C#, but there you go.

If you can't see this option I suspect it's not installed properly.

Dec 18, 2012 at 11:56 AM

Hmmm... as you can see, I do not have Visual C# under Other Languages...

Dec 18, 2012 at 11:58 AM

OK... Uninstalling the .exe and reinstalling did the trick.  Thank you!!!

Dec 18, 2012 at 12:23 PM

Alright, now that I have this working. :)

  1. I really like the .ts -> .js conversions.  This is what I would expect.  However, I would like to be able to do this with my C# files.  Is there a way to translate C# into .js files?  That is... .cs -> .js?  If not, there should be. :)
  2. The template that we mention above is for an application.  I would like to see more of a traditional .NET approach with Class Assemblies, so that I can encapsulate common functionality into a library and include it within my applications.  Is this possible/planned?

 Thank you for any clarification!

Dec 18, 2012 at 12:59 PM

1) No there's no way to translate C# to JS - well, you can do it manually of course, convert it line for line yourself ;)

2) Doesn't exist out of the box, but isn't hard to emulate. We have one master project in our solution which compiles a set of commonly used libraries into a single definition file, which other projects then reference and use. Probably about as close as you're going to get right now. TypeScript isn't .NET, you're going to struggle a bit if you try to look for a one-to-one comparison between the two. Best to attack it with a fresh set of eyes imho. Plus it's still evolving at quite a rate, bit of a rollercoaster atm to be honest.

Dec 18, 2012 at 1:07 PM

Hmmm... that is surprising as TypeScript was supposedly developed by the architect of C#/.NET, wasn't it?  It just seems like it would follow the same pattern/paradigm of having any language compile "down" into script.

I realize that this is still a preview tech.  I'm just voicing my perspective having been in .NET over a decade (and still very much interested in being able to "develop-once, run-anywhere"), and from a market-adoption strategy, this seems like the "right" (not to mention obvious) thing to do.

I have over 6 years' worth of code in a .NET framework.  It would be awesome to port it over to TypeScript in an easy fashion and work with it just like I have been doing in .NET-land...

Dec 18, 2012 at 1:17 PM

From the presentations he's given (and comments posted on these forums) it seemed clear, to me at least, that TypeScript was never meant to be a means to get .NET into JavaScript, or even to re-create that environment. I'm thankful for that personally, I need good clean exported JavaScript that plays well with the countless ways in which the web is built and TS offers me that. The JS code it produces understands the diversity of the web and fits in cleanly.

Re-creating .NET in JS to me sounds like some kind of sister project that could use TS at its core, but isn't what TS set out to address. It's a level lower, i.e. the equivalent of the C# part of .NET, not the framework itself.

Dec 18, 2012 at 1:21 PM

Cool... thanks for the clarification.  There is also Script# and I've been checking that as well.  That appears to be more aligned with what I'm looking to achieve.  Thank you for the dialogue!

Dec 18, 2012 at 2:09 PM

No problem. These are just my own personal observations of course. MS could release TypeScript .NET tomorrow for all I know! Just saying :)

Dec 19, 2012 at 12:36 AM

my understanding has always been that the point of TypeScript is simply a layer on top of JavaScript that adds compile-time type checking, and validation to enable scalable (as in project size) development. I have never seen anything to suggest that there is any relationship with .Net.

Dec 19, 2012 at 1:44 AM
MichaelDBang wrote:

Hmmm... that is surprising as TypeScript was supposedly developed by the architect of C#/.NET, wasn't it?  It just seems like it would follow the same pattern/paradigm of having any language compile "down" into script.

You're speaking about Anders Hejlsberg - who is indeed a member of the TypeScript team - but as far as most of us can determine, he only joined around the release 0.80 timeframe. So it would be a gross injustice to the other majority of people who developed TypeScript to attribute it all to one - albeit talented - figurehead. Of course, his involvement does elevate the external "credibility" of the project and I'm sure he will guide it well.

Dec 19, 2012 at 1:45 AM
photonstorm wrote:

No problem. These are just my own personal observations of course. MS could release TypeScript .NET tomorrow for all I know! Just saying :)

Someone in Microsoft has a pet project called Script# (scriptsharp) does exactly this: C# to javascript.

Dec 19, 2012 at 2:58 AM

I can start a new Typescript project in VS, but I'm unable to get any of the sample applications to work in the VS environment.  I can run them from Node commands but no luck in VS?  Also, I don't understand why the only VS template lives in the C# area