[HN Gopher] CoffeeScript for TypeScript
       ___________________________________________________________________
        
       CoffeeScript for TypeScript
        
       Author : paulsb
       Score  : 19 points
       Date   : 2023-02-27 22:19 UTC (41 minutes ago)
        
 (HTM) web link (civet.dev)
 (TXT) w3m dump (civet.dev)
        
       | adamwong246 wrote:
       | Finally. I miss coffeescript everyday.
        
       | 0x62c1b43e wrote:
       | If I were going to do this, I'd probably go all the way to using
       | ReScript, but it's a nice idea.
       | 
       | I'm quite surprised it's not called ToffeeScript though.
        
       | vore wrote:
       | I'm not sure if getting some extra syntactic sugar is worth
       | adopting a whole other language into a codebase: at least, that
       | seemed to be one of the lessons from CoffeeScript.
        
         | Klathmon wrote:
         | Eh, as long as the team is on board, and the sugar is simple
         | enough and maps well to the underlying language without a ton
         | of extra code, then I have no issues with it.
         | 
         | If it ever becomes a liability, you just check in the
         | "transformed" code and it's gone.
        
       | justsomeuser wrote:
       | Under "Everything is an Expression":                       items
       | = (() => {               const results = [];               for
       | (const item of items) {                 if (item.length) {
       | results.push(item.toUpperCase());                 } else {
       | results.push("<empty>");                 }               }
       | return results;             })();
       | 
       | Seems like they are purposely making the JS version extra long.
       | It could be:                       items = items.map(x =>
       | x.length > 0 ? x.toUpperCase() : `<empty>`)
        
         | [deleted]
        
         | [deleted]
        
         | 8f2ab37a-ed6c wrote:
         | My kingdom for "everything is an expression" in JS/TS, but that
         | would likely require an entirely new language.
        
           | davedx wrote:
           | At some point you might as well just use lisp, right? :D
        
         | mattigames wrote:
         | Given than in JS an empty string is a falsy value you can go
         | even shorter:                    items = items.map(x =>
         | x.toUpperCase() || `<empty>`)
        
       | [deleted]
        
       | giraffe_lady wrote:
       | please just use rescript it addresses every problem with js/ts
       | and is simpler and you get a sound type system please.
        
         | 0x62c1b43e wrote:
         | The compilation speed of ReScript is also great
        
       ___________________________________________________________________
       (page generated 2023-02-27 23:00 UTC)