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.…
I agree that config and tooling are the hardest part of getting Typescript working. Everybody is saying use a framework, but if your use case deviates from the frameworks it can get pretty difficult. My use case that was very tricky to config was. - SSR rendering of react in an express app (both typescript). -Trying to get VSCode visual debugger to work for both the client and server code paths. - Getting the various…
Figma’s Journey to TypeScript
201–210 of 257 posts
Re: Figma’s Journey to TypeScript
#202Earlier quoted context omitted.
that's like asking if a pen or keyboard lead to bloat. depends on who's using them.
More like if AI leads to spam or if guns kill people. The latter one is harder if you only have a knife instead of an assault rifle.
Re: Figma’s Journey to TypeScript
#203Re: Figma’s Journey to TypeScript
#204Earlier quoted context omitted.
I manage a relatively junior developer who has been using ts ignorer statements a couple of. times. I have said to him, that everytime he feel inclined to either use ts ignorer or do type coercion, he should call me first. every single time it is a reasoning flaw implementing a solution that is sub par and bug riddled. Had they just let types guide them, they would have become better developers and not had broken the…
Duck typing can lead to a false sense of security when you /think/ you have Foo when in reality you have Bar with the same shape. Also Typescript sucks at keeping track of type changes in a single scope. While in Rust I can assign string to foo and then update it with int, I can't in Typescript. This leads to worse types or worse code for the same operation. Combined with typescript's lack of statements as values, co…
When do you need to do that? Can you give an example?
Re: Figma’s Journey to TypeScript
#205Earlier quoted context omitted.
Isn't FB/Meta still on Hack + HVVM?
They are. At this point it's a completely different language with its own stack, as far as I know that will be a core component for the forseable future. Now they also have modern PHP and some other languages alongside with hack from what I understand.
Re: Figma’s Journey to TypeScript
#206Earlier 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.
JavaScript has had this for a bit now and it is really nice.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Re: Figma’s Journey to TypeScript
#207https://www.figma.com/blog/how-we-rolled-out-our-own-permiss...
Re: Figma’s Journey to TypeScript
#208Earlier quoted context omitted.
Duck typing can lead to a false sense of security when you /think/ you have Foo when in reality you have Bar with the same shape. Also Typescript sucks at keeping track of type changes in a single scope. While in Rust I can assign string to foo and then update it with int, I can't in Typescript. This leads to worse types or worse code for the same operation. Combined with typescript's lack of statements as values, co…
> Duck typing can lead to a false sense of security when you /think/ you have Foo when in reality you have Bar with the same shape. This is literally always your problem with javascript, its only sometimes your problem with typescript. It's a weird argument. > Also Typescript sucks at keeping track of type changes in a single scope. Isn't this considered a very bad practice? Also rust does not allow this, it only all…
For the second one: I know it is shadowing, what I mean is I find commonly that I'd like to have it in Typescript as well. In JavaScript is not necessary since I can just use the same variable.
For the third one: If I have some string variable that needs to be created from either one set of instructions or another, in Rust I do exactly that:
let foo = if x { ... } else { ... }
In ts your options are making it mutable undefined and mutate it inside the if else, using a very weird unreadable ternary, using an IIFE that returns into the constant, or creating extra functions to move the logic out. None of these are even close in readability, locality, or soundness to the rust example.
I find the _combination_ of those things that make it harder to write ts than js.
Re: Figma’s Journey to TypeScript
#209Earlier 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.…