This is brilliant! The first three features, i.e. --allowJs, --reactNamespace, and stateless functional componentshave been precisely the things that I have been missing recently.
This makes integrating 3rd party JS libs much easier and I can streamline my components a little since I'm almost exclusively using stateless components anyway.
That already made me quite happy. But as I'm reading on I almost can't believe all the other great additions, such as module augmentations, string literal types, AMD module concatenation, let/const in loops. It's like they've been reading my mind. These were all things on my wishlist. Great work!
Cool application. It's something I've wanted for a while, and I'd probably use it. But linking it here apropos of almost nothing seems a little like shilling.
I don't know if you're setting me up for a joke here, but you're putting the ball an inch away from an open goal:
Javascript is Typescript. Typescript ⊇ Javascript.
Especially if you already use Babel (or any other JS preprocessor, like uglify or concat) and have a build pipeline ready, you can start using Typescript today.
Don't miss out!
PS: It will throw a lot of errors on a conventional codebase, but compile despite them. That's the point; install the compiler today, slowly start fixing the errors as you go. It's all about gradual improvement and optional typing.
I had the same dream... so I started using Flow[0]! Put all of my codebase in /* @flow weak */ to start, then slowly tightened it up with more type hints, declarations, etc.
"For example, for a quick ES6 to ES5 downlevel conversion using the TypeScript compiler, you just need the following command: > tsc --allowJs --outDir out target_file.js"
Is the intent here to allow tsc to be used as a replacement for babel?
I am really puzzling what is Microsoft trying to accomplish here? Eventually a C# that compiles to JavaScript? TypeScript is a great language, and surprisingly (or not) it's more successful than Dart. Now, of course, I want TypeScript to compile to CLR as well. :)
I think people read into TypeScript too much. It's just a "right-now minimal-hassle" way to make front-end dev's lives easier, nothing more.
Maybe Microsoft disagrees, but I see TypeScript as something intended to make itself obsolete: eventually, when all browsers are running ES9 (or whichever version we decid has fixed "all" of JavaScript's problems) or WebAssembly (and we're all writing front-end code in C#/C++/Ruby/whatever), then TypeScript will just fade away, by design. For now, it's kinda like JQuery in motivation if not literally architecture: it shields you from browser inconsistencies (in this case, where you don't know what ES version the target is running) and helps you avoid JavaScript's headaches. Just as JQuery became less necessary as time went on-- not because it got worse but because browsers got better-- so too will TypeScript.
That actually existed internally at MS, along with many other projects to improve developing large JS codebases, most of which have fallen by the wayside. There was even a Flow-like compiler that worked with type annotations in comments. TypeScript has won out, although there is a LOT of code written in these other projects.
I love TypeScript - it's my favorite precompiled language and I use it for a few personal projects of mine. But I can't help but feel it's an evolutionary dead end. asm.js / web assembly is what you want transcompiled languages to target
It would be refreshing if the ES evolution would take some hints from TypeScript instead of satisfying the perceived need for syntactic sugar and cutesey poor man's FP.
> While React has paved the way, JSX syntax is not only tied to React.
Does TypeScript manage the lifecycles of elements you create through their version of JSX? React creates an in memory version of the DOM and reconciles changes to the DOM against this. Is TypeScript doing this too or is this simply template syntax inside JavaScript? What React does is not simply template syntax. HTML and JSX are totally different things! JSX renders to HTML eventually, but there's way more going on.
According to https://github.com/Microsoft/TypeScript/wiki/JSX, there are two JSX processing options. The first is a JSX passthru ("preserve" mode) and the second ("react" mode) will generate React.createElement, etc. See that page for the technical details.
As such, preserve mode is intended for use with other backends, e.g. those listed under Transpilers at https://facebook.github.io/jsx/. Whichever non-React backend you choose therefore defines the JSX runtime handling rather than having that baked into TypeScript.
I don't think this applies. I don't believe anybody else was doing what TypeScript does when it was released, that is JavaScript + Type Safety. Even today the only other real contender is Flow.
[+] [-] bunkerbewohner|10 years ago|reply
This makes integrating 3rd party JS libs much easier and I can streamline my components a little since I'm almost exclusively using stateless components anyway.
That already made me quite happy. But as I'm reading on I almost can't believe all the other great additions, such as module augmentations, string literal types, AMD module concatenation, let/const in loops. It's like they've been reading my mind. These were all things on my wishlist. Great work!
[+] [-] DanRosenwasser|10 years ago|reply
[1] https://github.com/Microsoft/TypeScript/wiki/What's-new-in-T...
[+] [-] cpeterso|10 years ago|reply
[+] [-] awa|10 years ago|reply
[+] [-] rekoros|10 years ago|reply
[+] [-] meowface|10 years ago|reply
[+] [-] jonesb6|10 years ago|reply
Edit: I meant refactoring as a way to improve the project, learn typescript, and learn the project itself inside and out.
[+] [-] nothrabannosir|10 years ago|reply
Javascript is Typescript. Typescript ⊇ Javascript.
Especially if you already use Babel (or any other JS preprocessor, like uglify or concat) and have a build pipeline ready, you can start using Typescript today.
Don't miss out!
PS: It will throw a lot of errors on a conventional codebase, but compile despite them. That's the point; install the compiler today, slowly start fixing the errors as you go. It's all about gradual improvement and optional typing.
[+] [-] girvo|10 years ago|reply
[0] http://flowtype.org/
[+] [-] igl|10 years ago|reply
http://tryflow.org/#2944d91c10fc5d76faeebbb20cac466a Try this snippet in TS.
[+] [-] recursive|10 years ago|reply
var x: any = {}; x.foo();
Here's the typesafe way: http://tryflow.org/#b5f826e03045f64084cfc74398270e85
[+] [-] altano|10 years ago|reply
[+] [-] unknown|10 years ago|reply
[deleted]
[+] [-] altano|10 years ago|reply
> var cats : Cat[] = [ new Cat() ]
[+] [-] breck|10 years ago|reply
Is the intent here to allow tsc to be used as a replacement for babel?
[+] [-] scott_o|10 years ago|reply
[+] [-] nikolay|10 years ago|reply
[+] [-] Analemma_|10 years ago|reply
Maybe Microsoft disagrees, but I see TypeScript as something intended to make itself obsolete: eventually, when all browsers are running ES9 (or whichever version we decid has fixed "all" of JavaScript's problems) or WebAssembly (and we're all writing front-end code in C#/C++/Ruby/whatever), then TypeScript will just fade away, by design. For now, it's kinda like JQuery in motivation if not literally architecture: it shields you from browser inconsistencies (in this case, where you don't know what ES version the target is running) and helps you avoid JavaScript's headaches. Just as JQuery became less necessary as time went on-- not because it got worse but because browsers got better-- so too will TypeScript.
[+] [-] wx196|10 years ago|reply
[+] [-] altano|10 years ago|reply
That actually existed internally at MS, along with many other projects to improve developing large JS codebases, most of which have fallen by the wayside. There was even a Flow-like compiler that worked with type annotations in comments. TypeScript has won out, although there is a LOT of code written in these other projects.
[+] [-] itslennysfault|10 years ago|reply
[+] [-] pippy|10 years ago|reply
[+] [-] moonchrome|10 years ago|reply
[+] [-] peteretep|10 years ago|reply
[+] [-] ybx|10 years ago|reply
It looked like it had some promise, since it wasn't nearly as heavy as emscripten, but I don't think much has happened with it since it was created.
[+] [-] _pmf_|10 years ago|reply
[+] [-] VeilEm|10 years ago|reply
Does TypeScript manage the lifecycles of elements you create through their version of JSX? React creates an in memory version of the DOM and reconciles changes to the DOM against this. Is TypeScript doing this too or is this simply template syntax inside JavaScript? What React does is not simply template syntax. HTML and JSX are totally different things! JSX renders to HTML eventually, but there's way more going on.
[+] [-] saidajigumi|10 years ago|reply
As such, preserve mode is intended for use with other backends, e.g. those listed under Transpilers at https://facebook.github.io/jsx/. Whichever non-React backend you choose therefore defines the JSX runtime handling rather than having that baked into TypeScript.
[+] [-] orf|10 years ago|reply
[+] [-] Guillaume86|10 years ago|reply
[+] [-] crudbug|10 years ago|reply
[+] [-] chinhodado|10 years ago|reply
[+] [-] scotty79|10 years ago|reply
[+] [-] Ycros|10 years ago|reply
[+] [-] z3t4|10 years ago|reply
[+] [-] slantview|10 years ago|reply
[+] [-] jbrantly|10 years ago|reply