Under "Everything is an Expression": items = (() => { const results = []; for (const item of items) { if (item.length) { results.push(item.toUpperCase()); } else { results.push(" "); } } 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() : ` `) Edit: Just realised the code on the right is the compiled code, not the "…
My kingdom for "everything is an expression" in JS/TS, but that would likely require an entirely new language.
CoffeeScript for TypeScript
11–20 of 143 posts
Re: CoffeeScript for TypeScript
#12please just use rescript it addresses every problem with js/ts and is simpler and you get a sound type system please.
Re: CoffeeScript for TypeScript
#13Re: CoffeeScript for TypeScript
#14I’m quite surprised it’s not called ToffeeScript though.
Re: CoffeeScript for TypeScript
#15Under "Everything is an Expression": items = (() => { const results = []; for (const item of items) { if (item.length) { results.push(item.toUpperCase()); } else { results.push(" "); } } 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() : ` `) Edit: Just realised the code on the right is the compiled code, not the "…
Re: CoffeeScript for TypeScript
#16I feel like this is exactly the right kind of slogan for a project like this. Smug and opinionated, disregarding anyone who might not feel the same.
Re: CoffeeScript for TypeScript
#17 data
|> Object.keys
|> console.log
when you could have done |> data
Object.keys
console.log
Or even better, don't introduce new syntax and just make it a simple function instead |>(data,
Object.keys,
console.log))
Yes yes, I know "|>" is not a legal variable/function name right now, but also, why not?!Re: CoffeeScript for TypeScript
#18If 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.
'Civet' certainly implies your code is being processed, but I'm not sure the connotation is desirable.
And all IMHO of course, but significant-whitespace is the worst idea ever.
Re: CoffeeScript for TypeScript
#19If 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.
Wasn't super popular, but wasn't unknown either.
Re: CoffeeScript for TypeScript
#20Under "Everything is an Expression": items = (() => { const results = []; for (const item of items) { if (item.length) { results.push(item.toUpperCase()); } else { results.push(" "); } } 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() : ` `) Edit: Just realised the code on the right is the compiled code, not the "…
Your version doesn't correspond to the code written on the left side.
I thought it was the comparable hand written JS.