TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

TypeScripting the technical interview

727 pointsby ycitmabout 2 years ago

27 comments

magnioabout 2 years ago
This is a delightful read, which reminds me of two other articles. The first is also a caricature of the technical interview, solving FizzBuz with Tensorflow: <a href="https:&#x2F;&#x2F;joelgrus.com&#x2F;2016&#x2F;05&#x2F;23&#x2F;fizz-buzz-in-tensorflow&#x2F;" rel="nofollow">https:&#x2F;&#x2F;joelgrus.com&#x2F;2016&#x2F;05&#x2F;23&#x2F;fizz-buzz-in-tensorflow&#x2F;</a><p>The second is a explanatory story, or &quot;discovery fiction&quot; as the article classifies itself: <a href="https:&#x2F;&#x2F;paulbutler.org&#x2F;2022&#x2F;what-does-it-mean-to-listen-on-a-port&#x2F;" rel="nofollow">https:&#x2F;&#x2F;paulbutler.org&#x2F;2022&#x2F;what-does-it-mean-to-listen-on-a...</a><p>I love these humorous yet pedagogic technical writings, woven with a bit of literary eloquence and down-to-earth narrative. Thank you for this.
评论 #35124164 未加载
评论 #35122735 未加载
评论 #35122495 未加载
ex3xuabout 2 years ago
Long ago, on Svalbard, when you were a young witch of forty-three, your mother took your unscarred wrists in her hands, and spoke:<p><pre><code> Vidrun, born of the sea-wind through the spruce Vidrun, green-tinged offshoot of my bough, joy and burden of my life Vidrun, fierce and clever, may our clan’s wisdom be yours: Never read Hacker News </code></pre> But Hacker News has read of you, in their snicker-slithing susurrential warrens, and word has spread...<p><a href="https:&#x2F;&#x2F;aphyr.com&#x2F;posts&#x2F;341-hexing-the-technical-interview" rel="nofollow">https:&#x2F;&#x2F;aphyr.com&#x2F;posts&#x2F;341-hexing-the-technical-interview</a>
评论 #35125680 未加载
cjbprimeabout 2 years ago
In case folks miss the link at the top of the article, this is translated from an old 2017 post by Aphyr.<p>That post was in Haskell, where it&#x27;s not too surprising that you can do serious computation inside the type system.<p>This new post translates the ideas to TypeScript, which is more widely known, and which I once heard described as having &quot;accidentally Turing-complete&quot; types:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;TypeScript&#x2F;issues&#x2F;14833">https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;TypeScript&#x2F;issues&#x2F;14833</a>
评论 #35122711 未加载
评论 #35122641 未加载
评论 #35122577 未加载
评论 #35127909 未加载
jitlabout 2 years ago
If you want to see some more legs on TypeScript type-level logic, check out this SQL database as Typescript types: <a href="https:&#x2F;&#x2F;github.com&#x2F;codemix&#x2F;ts-sql">https:&#x2F;&#x2F;github.com&#x2F;codemix&#x2F;ts-sql</a>:<p><pre><code> import { Query } from &quot;@codemix&#x2F;ts-sql&quot;; const db = { things: [ { id: 1, name: &quot;a&quot;, active: true }, { id: 2, name: &quot;b&quot;, active: false }, { id: 3, name: &quot;c&quot;, active: true }, ], } as const; type ActiveThings = Query&lt; &quot;SELECT id, name AS nom FROM things WHERE active = true&quot;, typeof db &gt;; &#x2F;&#x2F; ActiveThings is now equal to the following type: type Expected = [{ id: 1; nom: &quot;a&quot; }, { id: 3; nom: &quot;c&quot; }];</code></pre>
nicolas-siplisabout 2 years ago
I remember reading the original version and thinking &quot;Ah, this would be so much more grokkable if only I knew Haskell&quot;... Delusions of grandeur are a marvelous thing!
评论 #35127962 未加载
dec0dedab0deabout 2 years ago
So he wrote all that for the typescript lsp to respond with the answer, but when it compiles down it&#x27;s nothing? And we&#x27;re using runes as variables just because?<p>That is pretty neat, and silly.<p>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.
评论 #35122492 未加载
评论 #35133647 未加载
评论 #35133520 未加载
评论 #35124552 未加载
jupp0rabout 2 years ago
Pretty sad that computations on types look like C++98 in Typescript when C++ itself has moved on to have much more concise ways of performing computations on types in C++11 and 14 (see boost hana).
评论 #35131362 未加载
joenot443about 2 years ago
Well written and super funny. Reminded me a bit of Scott’s writing, particularly the descriptions of the horrified interviewer.<p>I’ve never worked in a Typescript shop, is there any truth to the satire here? The sea of confusing types to solve any problem?
评论 #35122486 未加载
评论 #35140124 未加载
评论 #35122287 未加载
评论 #35122837 未加载
评论 #35123128 未加载
评论 #35124148 未加载
评论 #35122757 未加载
评论 #35127980 未加载
Buttons840about 2 years ago
Why did they only solve for 7 Queens and not 8 Queens?<p>I&#x27;m reminded of <a href="https:&#x2F;&#x2F;github.com&#x2F;type-challenges&#x2F;type-challenges">https:&#x2F;&#x2F;github.com&#x2F;type-challenges&#x2F;type-challenges</a> -- I&#x27;ve only looked at some of the more challenging problems, but one involves writing a JSON parser in the type system. The easy problems look reasonably useful to solve.
评论 #35124875 未加载
thih9about 2 years ago
I’m unfamiliar with TS. Could someone explain this part?<p>&gt; Invoke the compiler<p><pre><code> $ tsc *.ts --lib esnext --outFile &#x2F;dev&#x2F;stdout var ᚾ = Symbol(); var ᛊ = Symbol(); var ᛚ = Symbol(); var ᛞ = Symbol(); </code></pre> Why is there so little output? Is that because the compiler removed the unneeded types? And the author is implying that the task was boilerplate and pointless?
评论 #35136677 未加载
davidmurdochabout 2 years ago
This is what I mean when I search for &quot;How to ______ in TypeScript&quot;: types! Too many blogs and Stack Overflow questions say &quot;TypeScript&quot; when they mean JavaScript, making it harder to find information on actual type problems.
dustedabout 2 years ago
Next time someone asks me if I know TypeScript, I&#x27;ll tell them &quot;No, I don&#x27;t even know JavaScript, in fact I don&#x27;t know anything.&quot;
btbuildemabout 2 years ago
Very nice read.<p>I would not hire nor want to work with this developer.
评论 #35131338 未加载
implicitabout 2 years ago
Richard has a whole series of these.<p>I was going to try to pick out one of my favourites from this series, but I really can&#x27;t. Every last one is a treasure.<p>EDIT: Oops! This is based on Aphyr&#x27;s work. My bad!
评论 #35122539 未加载
winridabout 2 years ago
Well written. I laughed hard at &quot;he asserts, wrongly&quot;.<p>I wish TS didn&#x27;t evolve into this complexity. Library types that should be simple turn into a machine you have to understand (for no good reason).
jtinderabout 2 years ago
An amazing read, and <i>almost</i> perfect!<p>There&#x27;s a bug in the Solve &quot;function&quot; due to which you&#x27;ll get the right answer only for 1x1, 5x5 and 7x7 (I checked till 8x8).<p>The base case makes a wrong assumption that there will always be a candidate available for the last row. If there are no candidates available, it should return Nil, and backtrack.<p>Basically, replace<p><pre><code> Concat&lt;candidates, placedQueens&gt; </code></pre> with<p><pre><code> candidates extends Cons&lt;infer x, any&gt; ? Cons&lt;x, placedQueens&gt; : Nil</code></pre>
评论 #35139821 未加载
iampimsabout 2 years ago
Make sure you read till the end. Brilliant.
mrlktsabout 2 years ago
I&#x27;ve got a CS related degree, but I&#x27;m a mostly self-taught dev, and not understanding 90% of the code really makes me reevaluate my career choices. Where and how can I learn this stuff?
评论 #35133180 未加载
评论 #35216328 未加载
评论 #35133099 未加载
评论 #35133852 未加载
评论 #35134130 未加载
golergkaabout 2 years ago
Another reminder that Typescript type system is Turning complete.
评论 #35123473 未加载
jonorsiabout 2 years ago
So beautiful and horrific at the same time :D.
hmcampabout 2 years ago
Thanks @ycitm. I learned a lot from this post!
ht85about 2 years ago
You can take me out of the Haskell—
borisskabout 2 years ago
TypeScript has the most complicated type system ever. Don&#x27;t know why Anders&amp;Co needed to go that far.
评论 #35123024 未加载
评论 #35123263 未加载
评论 #35122675 未加载
评论 #35122810 未加载
评论 #35123510 未加载
ycitmabout 2 years ago
You can also play around with the code in the TypeScript playground:<p><a href="https:&#x2F;&#x2F;www.typescriptlang.org&#x2F;play?#code&#x2F;PTAEEkDsAsEMBsCmAaUBLSBnAxgJzQEaIB0AsAFDYD2WALqIH1ooAvKAMoCeAtgVfABQBKCtTqhAU2gt23XgOGUameoC20KZx58hIxfUB7aGpmb5FEOwCuXLjVC1oiUADcqaACbpamRPABmqWJDcCDDc0egB3UOgbO1BETE9IbHsqb1AAAwY04lAAOUREF1RIKlsMAHNIOMxUW3tvXDMlXFhaAtB4GjLymypQImouEgpaDgAH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JqLYgZNkbgFc2HRm-N4LXnjtXbdddxbwSVsbdWvN9yT2TTPZu8q26q27tzbMzFo7JpkvcpJewmB1aDhoCxHIahzLjL4LbNA1hOKJr5ZSuaXiebjr5qYJSP8aCOUZOFVA5VmjYCLjEaKmBQhQacvMbOwQ+4uAKjHG+LEoDcmBAuT4tAijLhY12hd5izFXRXdixqBMj2PVJn-W6DG1wghuWTT97EfTAknd+t20sAAMUhxNMfXZBmgqAEMsS8n6Vg6nASacAzcViiAC1eVTGpgIEmTOkdQHJSzABmGzjHjMQdM45+RFm9MABY3N2c8w5t0ylLMAFZAsaeC9pw5Nk9MADYosefgFpszLkIRAA" rel="nofollow">https:&#x2F;&#x2F;www.typescriptlang.org&#x2F;play?#code&#x2F;PTAEEkDsAsEMBsCmAa...</a>
gardenhedgeabout 2 years ago
A good example of how TypeScript can be done so incredibly wrong.
game_the0ryabout 2 years ago
I am a 6-figure front end developer, work with typescript daily for the last 3 years.<p>I didn&#x27;t follow any of that shit. The fuck is an &#x27;n-queen&#x27;? I don&#x27;t think I learned that in my coding bootcamp.<p>Is that a bad sign?
评论 #35130983 未加载
评论 #35130556 未加载
irrationalabout 2 years ago
Is this really what technical interviews are like in Silicon Valley? I’ve never seen anything like it in the “real” world.
评论 #35124582 未加载
评论 #35124310 未加载
评论 #35124397 未加载