Uncomment one of the PGunXX types that you want to see, then below it type this:
const boardstr: PGun10 = ``;
Then put the cursor inside the two backticks and press Control+Space for intellisense autocomplete, and press enter on the first entry there. Then intellisense will put the computed board into a string literal, looking like: const boardstr: PGun10 = `............................................
........................xx..................
........................x..x................
..........x.x...............x......xx.......
........x...x..xxx..........x......xx.......
.xx.....x...................x...............
.xx....x....x.......xx..x..x................
........x.......x.x..x..xx..................
........x...x.....xxx.......................
..........x.x...............................
............................................`; declare const boardstr: PGun10
// ^?
1: https://www.npmjs.com/package/@typescript/twoslash[0] https://aphyr.com/posts/342-typing-the-technical-interview
[1] https://www.richard-towers.com/2023/03/11/typescripting-the-...
https://aphyr.com/posts/353-rewriting-the-technical-intervie...
These advanced type systems are essentially a form of pre-compile time scripting to assert certain guarantees about user defined types. It's the same mechanism that makes C++ templates turing complete.
[0] https://www.typescriptlang.org/docs/handbook/2/template-lite...
Conditional types are probably rarely used in practial code, but it opens the door for a lot of geekery.
[1] https://www.destroyallsoftware.com/talks/the-birth-and-death...
If anyone else is interested in an internship or full-time position in typescript: https://www.uncountable.com/hiring/hn
Any sufficiently advanced type system is indistinguishable from an interpreter!
type MyType<T> = someFunc(T)
Of course these functions might be typed too…
In college I did it in assembler (a couple hundred bytes of code) on a PDP11/34 and displayed the results on an oscilloscope screen :)