Live data from Hacker News

Figma’s Journey to TypeScript

figma.com

181–190 of 257 posts

Re: Figma’s Journey to TypeScript

#181
post #91

Earlier quoted context omitted.

It's ironic. For the past 5 years I've been writing type strict PHP. People love to shit on PHP yet I found that when I started using strict types my code quality improved, amount of lines needed to produce a result decreased, and necessary unit tests to produce the same result also decreased. Then a few months ago I decided to write a TS project from scratch. For the record I have 18 years of JavaScript experience.…

Yes, so on the only sizeable TS project I did (which was a library, to be used by other teams) I bypassed webpack entirely and went for a mixture of tsc and esbuild. But knowing to steer clear of webpack (or even - that you can!) is a barrier.

I use TypeScript and esbuild for all my stuff. Even then, I often spend a crazy amount of time getting modules working.

Between the various TypeScript module options and various package.json module options (and various code patterns used), modules make JavaScript way more painful than it should be.

I think most of the JS language standards work the past 10 years has been awesome, but modules was definitely rushed and poorly thought though, causing years of frustration.

Re: Figma’s Journey to TypeScript

#182
post #53

Earlier quoted context omitted.

Meh, as far as I can see PHP has a ton of very active development around web services and frameworks, which is its core value proposition. PHP as a language should probably slow down in general but the people who use it don't seem to be really dying out or slowing down as much as the bubble leads us to believe.

People hate php for no reason. They talk about performance or whatever while building rest crud apps. Literally any language can handle that easily and your bottleneck is usually the database. I've scaled startups on PHP to hundreds of thousands of users running on a few cheap ec2 instances. But no one wants to build new php projects instead focusing on Go, Python, or Ruby. I honestly don't get it. PHP devs earn less…

I think most people experienced PHP as the guilty party behind a lot of really, really terrible LAMP stack projects, but most of the time it was because mod_php was serving requests.

I used PHP to run some service workers managed with supervisord and it was fine. I just get annoyed with the class-based hierarchy but I'd guess they've evolved since 2017 or whenever I used it last.

Re: Figma’s Journey to TypeScript

#183

Earlier quoted context omitted.

People hate php for no reason. They talk about performance or whatever while building rest crud apps. Literally any language can handle that easily and your bottleneck is usually the database. I've scaled startups on PHP to hundreds of thousands of users running on a few cheap ec2 instances. But no one wants to build new php projects instead focusing on Go, Python, or Ruby. I honestly don't get it. PHP devs earn less…

I’ve written PHP off and on since the .php3 extension was a thing. People had very good reasons to hate PHP then. It’s greatly improved, but largely due to the composer ecosystem helping to paper over the worse bits. The global functions are still an awful mess.

Composer’s means of including packages doesn’t do the language any favours imo — it doubles down on namespaces (and complex PSR 4/7 ones at that) and the cli isn’t particularly intuitive.

To me, what PHP needs is a simple module system with scoped functions and variables, an object literal syntax rather than `new \stdClass`, and first-class simple to use threading/async/promises for concurrent requests and IO.

Re: Figma’s Journey to TypeScript

#184
post #6

Earlier quoted context omitted.

Coffeescript used to be "standard" in Ruby on Rails community. (insert canned laughter)

Coffeescript had astonishing success, so many constructs made it to ecma standard. Coffeescript is still better than js with many ideas - everything is an expression, comprehensions, existential operator, extended switch statement, chained comparisons overall terse, readable syntax. Some things are terrible ie. type annotations through clunky comments.

I think the absolutely fatal mistake CoffeeScript made was implicit variable declarations, and how that worked with variable shadowing. Once it became clear that it was downright dangerous not to hack explicit variable declarations in using IIFEs, the entire language became a clunky mess.

I have a ton of respect for the language and all of the stuff it cross-pollinated into JS, but it’s an interesting object lesson in how a seemingly tiny design choice can turn out to be disastrous.

Re: Figma’s Journey to TypeScript

#185

Earlier quoted context omitted.

It's ironic. For the past 5 years I've been writing type strict PHP. People love to shit on PHP yet I found that when I started using strict types my code quality improved, amount of lines needed to produce a result decreased, and necessary unit tests to produce the same result also decreased. Then a few months ago I decided to write a TS project from scratch. For the record I have 18 years of JavaScript experience.…

> What I found was that the biggest barrier to entry was configuring webpack to be "just right". As someone who has just spent a whole week trying to plumb Vite + Rollup into an ASP.NET web application, I can relate to this on many levels. I can produce 90% of our functionality with vanilla javascript + a sprinkling of JQuery, but to get something 'modern' in Vue.JS fitting into the application comfortably is a blood…

Yep, you're walking in one of the voids that is largely ignored by modern front end web dev. Frameworks like React and Vue advertise that your can easily add them to any page and that's technically true... but when you have a real world app built with a backend framework and you want to integrate it with React/Vue in a sane way... good luck to you!

All the pieces exist to make it work, but you won't find much documentation to help you. You'll have to rely finding blog posts, but of course if the post is more than a year old most of the libs or tools they're talking about will have totally changed. Once you do get everything up and running you'll often find that the dev experience is less than great.

Re: Figma’s Journey to TypeScript

#187
post #63

Earlier quoted context omitted.

It is actually a fairly indicative story. At the start there is a brilliant individual (Evan) who sets up an entire toolchain + core of the product. They then move on (or get pushed out, or get bored), and with the team (and the product) now being much bigger, things get replatformed to a more familiar, widely used stack. The success of these steps heavily depends on how robust the eng culture is at the organisation.…

It's ironic. For the past 5 years I've been writing type strict PHP. People love to shit on PHP yet I found that when I started using strict types my code quality improved, amount of lines needed to produce a result decreased, and necessary unit tests to produce the same result also decreased. Then a few months ago I decided to write a TS project from scratch. For the record I have 18 years of JavaScript experience.…

You don't have to transpile anything, you can just put your TS types in JavaScript comments. Or am I missing something?

Re: Figma’s Journey to TypeScript

#188
post #81
post #76

Earlier quoted context omitted.

I'm not against TypeScript, but I don't really see the massive advantage. I rarely see problems that are due to typing, and the downside is usually limited as I keep my JS on the frontend, not the backend. Regular JS/ES6 just flows better.

>I rarely see problems that are due to typing This is a fallacy similar to the Blub paradox: if your language has a weak[1] type system, then it isn't capable of recognizing many problems as "type error". But stronger type systems can express stronger invariants. So something that isn't a type error in one language will be a type error in another. This changes how the programmer conceives of problems. Example: missin…

The real Blub paradox to me is that the most powerful and expressive language is best characterized by minimalism at the language level.

Re: Figma’s Journey to TypeScript

#189

Earlier quoted context omitted.

It's ironic. For the past 5 years I've been writing type strict PHP. People love to shit on PHP yet I found that when I started using strict types my code quality improved, amount of lines needed to produce a result decreased, and necessary unit tests to produce the same result also decreased. Then a few months ago I decided to write a TS project from scratch. For the record I have 18 years of JavaScript experience.…

This is the reason that JS frameworks are a thing. Next is buggy and overbuilt, but Remix is pretty much plug and play, I strongly recommend checking it out.

Im surprised that Remix doesn’t get much love in the community. Or is it because Vercel and their influencer team is yelling so loud about Next that we can’t hear the Remix people?

Re: Figma’s Journey to TypeScript

#190
post #5

Skew wasn't just a little bit faster than TypeScript. According to Evan Wallace (former Figma CTO), it was 1.5x to 2x faster due to better optimizations enabled by stricter type system.

I really wish browsers had continued to develop a "use strong" mode for JS. It sounded like there were significant challenges, but curbing some dynamism in order for more predictable optimisation sounds like a great tradeoffs for production-quality apps.

Yeah, I wonder where that performance increase actually comes from. This[1] lists their optimizations.

My guess is mainly the integer optimizations. And I guess making sure that functions are always called with the same argument types. The other optimizations is already done by the JITs.

[1] https://evanw.github.io/skew-lang.org/

Post reply on HN