https://github.com/RuyiLi/cursed-typescript
TypeScript's type system is Turing complete - let's abuse that!
https://github.com/RuyiLi/cursed-typescript
game-of-life typescript
Last synced: 3 months ago
JSON representation
TypeScript's type system is Turing complete - let's abuse that!
- Host: GitHub
- URL: https://github.com/RuyiLi/cursed-typescript
- Owner: RuyiLi
- Created: 2023-08-25T17:53:42.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-03-14T10:04:11.000Z (over 1 year ago)
- Last Synced: 2024-08-10T19:16:52.314Z (about 1 year ago)
- Topics: game-of-life, typescript
- Language: TypeScript
- Homepage:
- Size: 18.6 KB
- Stars: 96
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A collection of cursed types, or a repository in which I abuse the fact that TypeScript's type system is Turing complete to write programs that "run" at compile time.
`type-challenges/` - My solutions to problems from https://github.com/type-challenges/type-challenges.
`random/` - Basically everything else, e.g. a [Conway's Game of Life simulator](random/game-of-life.ts), a [Sudoku solver](random/sudoku.ts), and a [Brainfuck interpreter](random/brainfuck.ts).
## TS(2589)
You _**might**_ be able to temporarily bypass the "Type instantiation is excessively deep and possibly infinite" error by editing the TypeScript server. Does not work in the playground.
1. Open the "Output" tab (View > Output)
2. Select "TypeScript" from the dropdown
3. Look for a log line that starts with "Using tsserver from: /tsserver.js"
4. Open `tsserver.js`
5. Ctrl-F "Type_instantiation_is_excessively_deep_and_possibly_infinite". There should be 4 occurences
6. For the 3rd and 4th occurences, change the number in the condition above to some much larger number (or just comment the blocks out altogether if you're brave)
7. Restart the TypeScript server