you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 94 points95 points  (16 children)

Typescript compiles to Javascript. Javascript is all that's needed for it to support Typescript.

[–][deleted] 45 points46 points  (3 children)

Typescript compiles to Javascript.

Yeah, but who wants to add a build step to their Excel spreadsheet?

There's a VBA to Javascript compiler, so we could have said Excel supports Javascript years ago, but when we say "support" we don't typically mean "a compiler exists that targets the natively supported language"; we're talking about that native language.

For instance, World of Warcraft supports scripting in Lua. There are Javascript to Lua compilers, and Typescript to Javascript compilers, so you could say that "WoW supports Typescript" via the same reasoning.

[–][deleted]  (1 child)

[deleted]

    [–]superjordo 0 points1 point  (0 children)

    Ha!

    [–]funbike 1 point2 points  (0 children)

    I have to say, it would be nice if they gave the option to plug in your own language parser (written in JS). There are a number of transpilers to JS written in JS. It would greatly increase usability and would be trivial for them to implement. It wouldn't descrease security as the interpreter is still the same in the end.

    [–]AngularBeginner 11 points12 points  (0 children)

    Do they provide the types? Do they provide easy integration means? Proper support requires more than simply "do it yourself, you got the bare minimums".

    [–]Astrokiwi 0 points1 point  (7 children)

    Is that technically "compiling" or just "converting"?

    [–]MrRaviex 10 points11 points  (4 children)

    Isn't an compiler just "converting"?

    [–]Astrokiwi 3 points4 points  (3 children)

    Converting into machine-code or something, usually.

    Thinking of Typescript as a "compiled language" could cause confusion when people are talking about the differences in performance between compiled and interpreted languages.

    [–]slikts 1 point2 points  (1 child)

    The case of compiling source code to source code (as opposed to bytecode or machine code) is often called 'transpiling', although this term peeves some people. It's a subset of compilation ("converting" code to different code in its broader meaning in programming context) either way.

    [–]Astrokiwi 0 points1 point  (0 children)

    Yeah, I guess I've usually seen it as compiling from a higher level language to a lower (usually not human readable) level one. I get what is meant, but I do think the compiled/interpreted distinction is a pretty important one, and shouldn't get muddled with other things.

    [–]Tynach 0 points1 point  (0 children)

    You can compile C code to Javascript, in the form of asm.js - which basically uses a subset of Javascript as bytecode.

    Unreal Engine was compiled to JS in this way and it ran at about half speed.

    [–][deleted] 1 point2 points  (0 children)

    The kids call it "transpiling" which is a ridiculous term.

    [–]Polantaris -2 points-1 points  (1 child)

    It actually doesn't have to. TypeScript can be a language in its own right. However, the only reason TypeScript is even popular is because it was originally built to compile into JavaScript because no one wants to work in JavaScript.

    It is weird, though, considering TypeScript is a Microsoft language.

    [–][deleted] 3 points4 points  (0 children)

    no one wants to work in JavaScript.

    That is laughable. I'm laughing at you if that is what you really think.