9

Typescript is beautiful.
Change my mind.

Comments
  • 3
    We all are beatiful.
  • 2
  • 3
  • 2
    Well, it kinda enforces the illusion that javascript is class oriented though, so that kinda sucks in my opinion Also, I recently discovered I can declare a type or interface inside a function (which is an object), but I cannot do it inside a "class" (which is also an object), why the hell not?

    Overall pretty good though. The best thing about it is that it aids in documenting the overall data flow.
  • 5
    @theuser I think it's a behavior common to a lot of OOP languages, although I couldn't explain why right now. Also, while I never tried TypeScript, I don't think giving the illusion that JS is typed is a bad thing per se. To make a (far fetched) metaphor, C is typed, but when it's compiled in machine language, there's no big difference between a char, a short or an int : they are all three values in memory. C just applies restrictions on the way to manage them, a bit like how TypeScript applies restrictions on how JavaScript variables are managed.

    That's how I see and understand it, but as I'm not an expert nor in memory management at very low level nor in applying meaningful metaphor, I may seem to talk out of my ass here.
  • 5
    @pipe I say your very much spot on.

    Any type system is just a language construct, once at machine code its just bytes.

    And for typescript, its types are only until its converted to js.

    Once at js there are no real types any more, just the standard js types.
  • 2
    @theuser

    Interesting notion. I hardly ever write classes in typescript. Angular requires them for components, but that's about it.

    Most of the logic I write are interfaces (non-instantiable typedefs with erasure), then I just compose functions. The functional story in typescript isn't Scala or Haskell, but it is pretty capable.

    There's not really a broad misunderstanding among typescript users that it produces runtime types. It's compile-time typechecking.

    Edit: didn't mean to tag pipe
  • 2
    Will be looking for massive adoption of WebAssembly as build target :) I feel like it will be a breeze to jump from TS to any language that is designed to be statically analyzed to the root. I may be wrong though, don't get super excited xD
  • 0
    @pipe I agree on the types, they are definitely a good thing for larger projects. TS is marketed as a replacement for JS in any project, but it really only makes sense for applications that communicate with APIs or in general has a somewhat complex data layer. I wouldn't really bother with TS serverside, you could do it just as well with JS and JSDoc.

    My issue is when they added the class syntax, which was the result of class oriented developers trying to make that work with JS despite it being prototype oriented. The.class syntax is just syntactic sugar on top of the prototype system. Fast forward today and the notion of writing javascript with prototypes are becoming increasingly rare.
  • 1
    @alexbrooklyn you know honestly I still don't even know what it looks like. The reason I don't use typescript has absolutely nothing to do with typescript. If it weren't for that I might consider it but it would still come down to a small internal debate.

    Generally I find the less abstraction the better and given that I've never ran into any problems typescript is supposed to eliminate, it doesn't seem all that beneficial to me at the moment. Not sure if that's something to do with svelte having clear error messages and outputting everything as a string or because I don't ever collaborate with anyone, I don't import a lot of modules and my own code is so impeccably well written( doubtful ).
  • 1
    I agree... But it's easy to be better than JS
  • 0
    Error: Property 'beautiful' does not exist on type 'typescript'.
Add Comment