Update TypeScript dependency to 4.1.2

This commit is contained in:
CismonX 2020-11-23 11:52:07 +08:00
parent c5e45ff429
commit debf00a0a2
Signed by: cismonx
GPG Key ID: 3094873E29A482FB
3 changed files with 11 additions and 11 deletions

View File

@ -9,7 +9,7 @@ type-unlambda - [Unlambda](http://www.madore.org/~david/programs/unlambda) inter
Installation:
```sh
npm install --save-dev typescript@rc
npm install --save-dev typescript
npm install --save-dev @esolangs/type-unlambda
```
@ -33,7 +33,7 @@ You're likely to get the following error when trying to run a program with type-
> Type instantiation is excessively deep and possibly infinite.ts(2589).
To write loops in TypeScript's type system, we have to use recursions, like we do in other purely functional programming languages. However, TypeScript's type system is not meant for general purpose programming, and recursion has its limits.
To write loops in TypeScript's type system, we have to use recursions, like we do in other purely functional programming languages. Meanwhile, we use [CPS](https://en.wikipedia.org/wiki/Continuation-passing_style) to implement continuations, which also introduces heavy recursion. However, TypeScript's type system is not meant for general purpose programming, and recursion has its limits.
In [src/compiler/checker.ts](https://raw.githubusercontent.com/microsoft/TypeScript/release-4.1/src/compiler/checker.ts), there is a hard-coded limit for type instantiation:
@ -44,6 +44,6 @@ if (instantiationDepth === 50 || instantiationCount >= 5000000) {
}
```
You may expect that there is an option somewhere where this limit can be configured, like `-ftemplate-depth=n` in gcc/clang. Unfortunately, there isn't, [and it's likely to stay that way](https://github.com/microsoft/TypeScript/pull/29602).
You may expect that there is an option somewhere that this limit can be configured, like `-ftemplate-depth=n` in gcc/clang. Unfortunately, there isn't, [and it's likely to stay that way](https://github.com/microsoft/TypeScript/pull/29602).
To workaround this limitation, we modify the code of `tsserver` or `tsc` in `node_modules` to loosen these limits until the error no longer applies. Changing `instantiationDepth` to `1000` is sufficient to run the example above.
To workaround this limitation, we modify the code of `tsserver` or `tsc` in `node_modules` until the error no longer applies. Changing `instantiationDepth` to `1000` is sufficient to run the example above.

8
package-lock.json generated
View File

@ -1,13 +1,13 @@
{
"name": "@esolangs/type-unlambda",
"version": "0.1.2",
"version": "0.2.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"typescript": {
"version": "4.1.1-rc",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.1-rc.tgz",
"integrity": "sha512-tgNcFrLIjlaMWEc7bKC0bxLNIt8BIAauY/HLUOQDyTP75HGskETtXOt46x4EKAHRKhWVLMc7yM02puTHa/yhCA==",
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.2.tgz",
"integrity": "sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ==",
"dev": true
}
}

View File

@ -1,6 +1,6 @@
{
"name": "@esolangs/type-unlambda",
"version": "0.1.3",
"version": "0.2.0",
"description": "Unlambda interpreter implemented in TypeScript's type system",
"keywords": [
"Unlambda",
@ -18,9 +18,9 @@
},
"license": "MIT",
"devDependencies": {
"typescript": "^4.1.1-rc"
"typescript": "^4.1.2"
},
"peerDependencies": {
"typescript": "^4.1.1-rc"
"typescript": "^4.1.2"
}
}