Earlier quoted context omitted.
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
[flagged]
TypeScripting the technical interview
51–60 of 180 posts
Re: TypeScripting the technical interview
#52 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
But Hacker News has read of you, in their snicker-slithing susurrential warrens, and word has spread...Re: TypeScripting the technical interview
#53Why did they only solve for 7 Queens and not 8 Queens? I'm reminded of https://github.com/type-challenges/type-challenges -- I'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.
There's a recursion depth limit of 500 on the TypeScript compiler, which prevents this solution working for N > 7
Even Aphyr's original Haskell solution only demonstrates N = 6, so in some sense this is an improvement on the state of the art for type-level N Queens solutions /s
Re: TypeScripting the technical interview
#54Re: TypeScripting the technical interview
#55Earlier quoted context omitted.
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
[flagged]
Edit: especially pertaining to type inference, I guess?
Re: TypeScripting the technical interview
#56Earlier quoted context omitted.
I make an exception for using any in type params which extend type params, eg const foo = >(dict: T) => … This is a good signal that foo maps over dict in some generic way that cares more about its dictionary-ness than its values. Sure, unknown works in that position too, but at least IMO the “doesn’t care” bit is more informative than “doesn’t know”. The latter might imply more type narrowing will happen than is the…
The problem with that is that when consuming of the dictionary, “doesn’t know” is actually more appropriate. If you then access Object.values(foo) in your method you are given an iterable of anys which is unsafe.
Re: TypeScripting the technical interview
#57Why did they only solve for 7 Queens and not 8 Queens? I'm reminded of https://github.com/type-challenges/type-challenges -- I'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.
I wondered if anyone would spot this :) There's a recursion depth limit of 500 on the TypeScript compiler, which prevents this solution working for N > 7 Even Aphyr's original Haskell solution only demonstrates N = 6, so in some sense this is an improvement on the state of the art for type-level N Queens solutions /s
Re: TypeScripting the technical interview
#58Re: TypeScripting the technical interview
#59In case folks miss the link at the top of the article, this is translated from an old 2017 post by Aphyr. That post was in Haskell, where it's not too surprising that you can do serious computation inside the type system. This new post translates the ideas to TypeScript, which is more widely known, and which I once heard described as having "accidentally Turing-complete" types: https://github.com/microsoft/TypeScript…
I'd say it's "inspired" rather than "translated". The part about using the typescript language server to compute the solution, and the protagonist claiming the code is "concise" because only 4 lines of javascript were generated, was absolutely brilliant. Cracked me up at least. Glancing at the actual code, I admit I'm with Criss in my ability to follow the logic, but it doesn't look like a direct translation from Has…
Re: TypeScripting the technical interview
#60Earlier quoted context omitted.
Can you link them? I couldn’t find them on his blog.
The series is actually by Aphyr: https://aphyr.com/tags/interviews This post is a pastiche of https://aphyr.com/posts/342-typing-the-technical-interview