introducing TScert, a sound core for TypeScript.
@ccrisccris1.5K followers
39,357 views
18 Comments
Comments from the original post on X (Twitter)

@poteto
👀
21 likes

@ccrisccris
the story: the code:
15 likes

@ccrisccris
TScert stands on decades of work on types and semantics: Appel & McAllester, Ahmed, Wright & Felleisen, Reynolds, Abadi & Cardelli, Frisch, Castagna & Benzaken, Pierce, Milner et al., JSCert, ECMA-262 and Lean 4. Each entry says what TScert takes from it:
15 likes

@MKassabov
Is there an example that isn't fixed by just having a stricter ts config?
5 likes

@ccrisccris
Yes. The README example is one a flag does catch (noUncheckedIndexedAccess); nearly all the strict flags were considered during development. No flag catches this: const xs: string[] = []; const ys: (string | number)[] = xs; ys.push(1); for (const x of xs) x.toUpperCase(); // TypeError Same for method parameter bivariance, or a callback that mutates the array being mapped.
4 likes

@smorimoto
Long time no see, Cristiano. As for me, I've recently written a TypeScript extractor plugin for Rocq. It now handles pretty much everything, but the problem is that the generated code is about twice as slow as hand-optimized code. I don't think it'll be an issue for things like state machines, but sorting algorithms are a real struggle.
2 likes

@EthanAlley
probably dumb question, but i seem to remember typescripts type system being unsound even in theory, not just as implemented. are you changing the type systems semantics to get around that or do i misremember?
2 likes

@ccrisccris
TypeScript has many strictness configurations. None of them is strict enough to be sound (for a variety of reasons). But it is compatible with such a setting. Then the question becomes being expressive enough to support the pattern that people (now agents) write.
1 like

@EthanAlley
right so it is stricter than the strictest typescript (and therefore semantically unlike any existing typescript config someone runs)?
1 like

@ccrisccris
Yes: because it uses a verified semantic model it can only be stricter than any unsound configuration. The question then is pragmatic expressivity rather than soundness.
1 like

@notegone
just curious why you chose NON-AI MIT License for a project programmed and documented with Claude
1 like

@filipfalcon
howdy fellow Lean TypeScripter 🤝 coming at it from the other side on @egonitida: the theory and proofs live in Lean, types and tests are generated from it, and Effect runs the implementation. you verify, i derive, keen on your take on it

@kalapowered
the other 56 functions have suddenly remembered an urgent appointment

@TylerKe11504158
I love this. Well done.

@Aron_Adler
> functions accepted only with a proof say more about this? what does a proof look like?

@DanieIMontilla
typa shi mfs do to not use effect

@EternitiesAI
628 of 684 verified, so the interesting bugs are hiding in the last 56 functions

@Iam_Injamul
@grok what is this? Looks like a typescript replacement?
