News for hackers. Stuff that matters.
Re:TypeScripting the Technical Interview by dec0dedab0de on Sunday March 12, 2023 @12:25PM (#35122084)
So he wrote all that for the typescript lsp to respond with the answer, but when it compiles down it's nothing? And we're using runes as variables just because?

That is pretty neat, and silly.

I also think it highlights my natural aversion to static type checking in dynamic languages. I know that I could get sucked into writing a bunch of code for the checker, instead of using my energy for making the application work.

Re:TypeScripting the Technical Interview by ycitm on Sunday March 12, 2023 @12:49PM (#35122492)
The runes are mostly "just because", but there is a reason.

Ideally, I would have written:

  type Nil = unique symbol
Which would ensure the Nil type wouldn't match with anything but itself. Unfortunately, the compiler doesn't allow unique symbol other than on const variables initialised with Symbol(). So I needed some meaningless symbols.

I could also have done

  type Nil = "nil"
But then it would have looked like the string meant something.
Re:TypeScripting the Technical Interview by 8n4vidtmkvmk on Sunday March 12, 2023 @02:56PM (#35124552)
this is why i love ts when not working for a megacorp. when the ts gets too cray i just nope out. throw an any or as in there and get on with my day. wouldn't pass a code review but i don't care
Re:TypeScripting the Technical Interview by trhr on Sunday March 12, 2023 @02:58PM (#35124572)
which bootcamp did you do
Re:TypeScripting the Technical Interview by rexpop on Sunday March 12, 2023 @03:31PM (#35125039)
This is a jab (insult), and I've flagged it, but I am also curious. If you could, please describe the qualities of a "bootcamp" grad by which you recognize them?

Edit: especially pertaining to type inference, I guess?

Re:TypeScripting the Technical Interview by trhr on Sunday March 12, 2023 @06:06PM (#35126924)
If you wanted to have a conversation, you wouldn't have flagged it. So, no.
Re:TypeScripting the Technical Interview by jholman on Sunday March 12, 2023 @09:53PM (#35129711)
I didn't flag it, and I'm curious too.
Re:TypeScripting the Technical Interview by trhr on Sunday March 12, 2023 @10:17PM (#35129989)
People who think code reviews are a thing imposed upon them by higher ups trying to make their job harder and not things designed to make their job easier don't understand how dev works at scale.

People who would do things that "wouldn't pass the code review" for smaller companies are a primary reason so many smaller companies get hard-fucked when they have to scale.

Arbitrarily deciding "this is too much work for me to do, so I'm going to take a shortcut" may not be the sign of a bootcamper, but it's certainly the sign of a shitty dev.

Either way, it's not someone I'll ever work next to. Elite teams don't hire people who think like that. We hire junior devs who are like "I write idempotent commits with good titles and descriptions, and I and use strict typing everywhere." Because it's easier to be teach them "actually, nobody's ever going to read your description. You can usually leave it out. You could use 'any' here. Just ticket it to be fixed so you can replace it later."

Point is 'any' shouldn't pass a code review without someone asking "why'd you use 'any' here." If you have a great answer, it will pass the code review.

Re:TypeScripting the Technical Interview by 8n4vidtmkvmk on Sunday March 12, 2023 @10:34PM (#35130177)
FWIW I do both. I work for a top tier tech company and I write pretty commit messages, test my code, and all that jazz. But for the side-project I do at home? You bet I'm cutting corners.

I also think the guts of a TS function don't matter much though. Write a test to confirm the behavior is correct, and then make the return type and argument types correct so that people can call it without hassle. If you need to use 'any' or 'as' inside the function, then go for it.

Re:TypeScripting the Technical Interview by trhr on Monday March 13, 2023 @01:43AM (#35131582)
I'm a Principal at a 2nd tier tech company.

My personal projects are more rigorous than my work projects. I don't have time to maintain them, so I have to be sure to not fuck them up.

Re:TypeScripting the Technical Interview by jholman on Wednesday March 15, 2023 @05:29AM (#35165766)
I'm having trouble grasping what this has to do with bootcamps. Isn't that the totality of the value of your original comment, implying that you had some trick for identifying bootcamp graduates?
Re:TypeScripting the Technical Interview by 8n4vidtmkvmk on Sunday March 12, 2023 @03:10PM (#35124760)
none? is this a jab?
Re:TypeScripting the Technical Interview by nine_k on Sunday March 12, 2023 @08:50PM (#35128993)
In a megacorp, an SRE in production would have to deal with a rare error condition which the compiler tried to complain about.

But in a smaller shop, oncall are developers, that is, ourselves.

Re:TypeScripting the Technical Interview by tlrobinson on Monday March 13, 2023 @06:26AM (#35133667)
IMHO it’s worth learning to properly type those cases, otherwise you never really know which parts of your application are actually being type checked.

Personally I also find coming up with the correct types to be gratifying if they’re a little tricky.

Re:TypeScripting the Technical Interview by al_be_back on Monday March 13, 2023 @06:06AM (#35133520)
brilliant article - the TS therein is type-hints basically, helping the coder program to chess spec. so yes, in that scenario it's not generating JS (functions etc) lol
Re:TypeScripting the Technical Interview by tlrobinson on Monday March 13, 2023 @06:23AM (#35133647)
> I know that I could get sucked into writing a bunch of code for the checker, instead of using my energy for making the application work.

“Making the application work” is only half the story. Making a large application stable and maintainable is only really possible with static type safety, IMHO.