1.0.0 • Published 5 months ago

jsits v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

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:

dttw.tech/posts/zi_YFfq15

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