[HN Gopher] A text adventure game on TypeScript's type system
___________________________________________________________________
A text adventure game on TypeScript's type system
Author : cacozen
Score : 135 points
Date : 2022-09-21 19:51 UTC (3 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| bilalq wrote:
| I never get tired of seeing fun little things like this. Is there
| a way to make VSCode not truncate the type info?
| wwwigham wrote:
| `noErrorTruncation: true` in a tsconfig.[1] It also affects
| hover and quickinfo truncation. Technically it will still
| truncate, just at a way higher limit, like a million
| characters.
|
| [1]https://www.typescriptlang.org/tsconfig#noErrorTruncation
| Kyro38 wrote:
| It's an open ticket.
| https://github.com/microsoft/vscode/issues/94679
| cercatrova wrote:
| Related, discussed previously, Type-Level TypeScript:
| https://news.ycombinator.com/item?id=32913125
| koshergweilo wrote:
| An interesting tidbit that I found in the source code is that it
| only accepts integers from 1 to 20. Perfectly sufficient for its
| use case, although not quite extendable as I would hope
| foota wrote:
| What the fuck
| notjustanymike wrote:
| Weirdly, a spider killing me isn't the worst thing I've seen
| written in Typescript.
| cacozen wrote:
| Congrats, you won the best comment of the day on Hacker News
| JohnDotAwesome wrote:
| For those wanting a TS Playground link:
| https://tinyurl.com/mw6pbpht
| frabjoused wrote:
| I made a PR to add this link to the readme.
| have_faith wrote:
| How do you play the game?
| lucasmullens wrote:
| git clone, make sure TypeScript is installed, and open
| src/index.ts
|
| Would be nice if this was exported to some TypeScript
| playground environment.
| yakkomajuri wrote:
| Easiest is to just press `.` on the GitHub repo to open the
| GH dev environment
| zander312 wrote:
| wtf! I had no idea this existed!
| dschuessler wrote:
| What a beautiful little treat. For everyone curious, it took me
| less than ten minutes to play through. Well done!
| noduerme wrote:
| This is neat. Can someone explain why the generic types extending
| string need to default to _any_ in all these cases, like:
| `TDescription extends string = any` ?
| cacozen wrote:
| It's just so I can later reuse that type without having to pass
| in the generic. Like I do on lines 41 and 42
___________________________________________________________________
(page generated 2022-09-21 23:00 UTC)