1.0.0 • Published 5 months ago
jsits v1.0.0
JavaScript in TypeScript (jsits)
Ready to commit crimes™ against your type system? Look no further than js-in-ts, the worlds first (probably (hopefully)) JavaScript interpreter written in TypeScript's type system!
What?
What.
Examples
import { Eval } from "../utils";
const factorial = <N extends number>(limit: N): Eval<`
(limit) => {
let rec = (val) => {
if (val > limit) {
return 1;
}
return val * rec(val + 1);
};
return rec(1);
}
`, [N]> => {
let rec = (val: number) => {
if (val > limit) {
return 0;
}
return val * rec(val + 1);
};
return rec(1) as any;
}
Getting started
yarn add jsits
How does it work?
Blood, sweat, and arcane magiks. For full details, check out this writeup:
Contributions?
Yeah, go for it! Just try not to make it too imperformant that the demos fail.
Credits
Zach Wade zach@dttw.tech (@zwad3)
1.0.0
5 months ago