strict-script strict-script

The project

Known limits

A step of the compiler that is not sure refuses the program. These are what a program that compiles still rests on, and what is accepted today although no type covers it.

#What the count says, and what it does not

  • The measure is a list of known ways, and is not a proof. The 84 files of strict-ts 1.0.0 that compile under strict TypeScript and break a promise when they are run were each written again in this language, as close as it lets them be written: 31 on typing, 29 on errors, 24 on mutability. 44 have no word for what they need, 33 are refused by a rule, 6 become a value in the type of the call, and 1 is accepted. Each is a test of packages/compiler/test/attacks.test.ts.
  • The one that is accepted: a function that calls itself without end overflows the stack of the engine. It stops the program, as panic does: nothing in the language catches it, so no code goes on with a broken value. It is not in a type.
  • Two more that are accepted, of the same kind: a value larger than the engine holds. A text doubled until it is too long, and a bigint squared until it is too large, stop the program with a RangeError that no type announces. Where the language can tell before the engine does, it says so in the type (repeat, ** on two bigints give an Option); a + cannot. Each is a test of packages/compiler/test/lists.test.ts. Not solved.
  • A number that is not one is accepted inside a program. 0 / 0, 1 / 0, Math.sqrt(-1), 1 % 0 and Number of a bigint too large give NaN or an infinity, in a number, and no type says so. Such a value is not equal to itself (ratio == ratio is false), and an array that holds one is left unsorted by sortedBy (3,NaN,1). Nothing throws; a program goes on with a value that is not what its type says it is, which is what this language is meant to have no word for. It was not on either list below: it was found on 2026-10-13 by running programs, after four reviews and a fuzzer that gave functions NaN and looked only for what throws. What is closed is the way in and the way out (packages/compiler/test/numbers.test.ts): a number that is not finite is not read by Type.parse, by the door of a module, from an extern nor from a text; a value that holds a number is written as JSON through a Result, never with a null in the place of a number; a written number that a number does not hold exactly is refused. The fuzzer asks, of the named types it writes, that a value written as JSON is read back the same. What is open is every operation above. It costs to close: a Result at each JSON.stringify of a number is already the price of the half that is closed. Not solved.
  • Two finite lists were gone through, one row each (lists.test.ts). 50 ways the ECMAScript specification lets a program of this family throw or read undefined, in its operators, its statements and the methods the language has: 15 have no word, 21 are refused, 13 are in the type of the result, 1 is accepted and safe. 30 entries of what TypeScript is known to accept though it is not sound: 14 have no word, 13 are refused, 2 are in a type, and 1 is the recursion above (a function that says it gives any type and never gives a value). The lists were written by the one who wrote the compiler, from the specification and from what is known of TypeScript: a row that is missing is not counted.
  • A row is a transcription, and a transcription is a judgement. Where an attack needs a word that is gone, its test shows that the word is refused; it does not show that no other text reaches the same end.
  • One review was made by someone who did not write the kernel, and it was an agent, not a person: about 190 programs written by hand and 1,400 generated. It found five ways to break a promise (three on resources and owned parts, one on async, one at the boundary) and a way to stop the compiler; each is closed, and is a test of packages/compiler/test/review.test.ts. Before it, the author had found seven. That is a reason to expect more, and no person has looked yet.
  • A second review by an agent, on what was added since the first: 1,051 programs, five more ways to break a promise, each closed and a test.
  • A third review by an agent, on the door of a module, the day it was written: twenty ways to break a promise through it, the worst with two correct calls and no line of the caller written against its types (the one None of every program was not frozen, and the door itself wrote into it). Each is closed and is a test of packages/compiler/test/door-review.test.ts. The chains of operations, read and written along their length the same day, held: 56 programs by hand, 600 generated. Twenty in a day on code that every test passed is the measure of what tests written by its author say.
  • A fourth review by an agent, on what the third had made the door become and on what it had not tried (the declarations for TypeScript, the adapters): 22 findings. The worst needed no hostile caller: a value lent to a function of the outside came back with the program's own functions replaced; a named type that takes a type and holds a function of it did not load; a cell in such a type was known by the name of the parameter; a resource lent to a running call could be handed back by it. 20 are closed and are tests (door-review-four.test.ts, and one that runs tsc); two are written below as what is taken on trust. The two fuzzer seeds it ran found nothing: what it found, a fuzzer that gives values of the types does not see.
  • Going back over this page found one more: it said that nothing catches what stops a program, and a call to the outside did, making an Err of a panic or of a stack that ran out. Closed, and a test of packages/compiler/test/outside.test.ts. A sentence of this page is a claim like any other.
  • The kernel was fuzzed, by a machine that writes programs, asks the compiler about each and runs what it accepts (packages/fuzz). The programs are made from the types down, taken from this repository and changed, or written to break ownership and to say whether they did. For a program that compiles, each exported function is called itself, and not through the door a TypeScript caller goes through, with values made from the types of its parameters: a failure is an exception, a value that is not of the type declared, a write to a value given to be read, a resource not ended once. One run of 1,200,000 programs (seed 2026) found nothing: 299,179 were accepted and run, in 2,113,065 calls. On the way to it the fuzzer found three ways to break a promise, which neither review had: a function that says it gives nothing gave a value; a resource handed to a function that only read it was ended twice; a parameter named as the function that ends a resource stopped the program. Each is closed and is a test of packages/compiler/test/fuzz.test.ts. The CI runs 60,000 programs on a seed that is written.
  • What the fuzzer does not see, and « fuzzed » does not cover:
    • what its generator has no word for: extern, async, elements, resources and Cell are reached only by the programs of the repository and by the attacks, which are a few dozen shapes drawn in combination;
    • a program that names the outside is compiled and not run (7,008 of the run);
    • the door of a module, which reads what a TypeScript caller gives, was written after that run. The fuzzer now makes each call a second time through it, where the values can be made twice (data and collections, not a function or a cell), and asks for the same answer: 315,628 of the 357,438 calls of a run of 200,000 programs (seed 9001), and nothing. It gives the door values of the types only: what the door refuses is tested by hand (door.test.ts);
    • a function that takes a resource or a value of the outside is not called from outside: the fuzzer has no value to give it. It runs when another function of the program calls it;
    • a promise broken inside a function that still gives back a value of its type;
    • a program that does not end is stopped by a clock and counted (421 of the run), not looked at;
    • whether a value is of its type is said by a reader written again for the fuzzer: if it is wrong the same way as the compiler, it hides the hole. It was wrong once on its own, and said so by a finding that was none;
    • a run says what was tried. Three quarters of what it writes is refused, most of it for its spelling.
  • Ownership has no list of attacks: strict-ts has none to give. Resources are tested on what they promise (ended on return, on the early return of ?, on break and continue), not against known ways around them.

#What is taken on trust

  • The JavaScript the compiler writes says what the source says: tested, not proven.

  • The compiler is written in the language, and checked by itself. packages/self/lib holds the JavaScript the compiler wrote for its own sources, and that JavaScript is what compiles them the next time. No other checker reads those sources any more: a mistake in the checker that also hides a mistake of the checker's own code would not be seen by it. What stands against that is the tests, which know nothing of the language the compiler is written in and passed unchanged at each step of the rewrite.

  • The template of a Vue component whose script is strict-script is Vue's. vue-tsc checks it against what the script gives, with the rules of TypeScript and no more. A function of the script reads what the template calls it with, and a cell reads what the template writes into it (v-model), so a cast or an any there is refused when the page runs it, and not before. See In a project.

  • A component of React whose first rendering is thrown away (React does that under Suspense, and when a rendering is interrupted) has run its setup, and its leave is never called: React says nothing of a rendering it drops. What setup started goes on. See In a project.

  • A component of React Native was not run on a phone, nor in a simulator: it is rendered by React Native's own test preset, and built by Metro. What the compiler writes is run on Hermes, the engine of a phone, as a command: a build of 2022, with nothing native around it. The Hermes that React Native 0.79 carries comes as a compiler only: it compiles the same program, and the bundle of the application, to the bytecode a phone is given, and nothing here runs that bytecode.

  • The engine: V8 in the tests, and Hermes for one program. Running out of stack or of memory is outside what the language covers.

  • A regular expression written with Regex.of is tried by the engine the compiler runs on, and taken to be one for the engine the program runs on. One that takes for ever on some text does so here as anywhere.

  • A program in TypeScript or JavaScript that calls a compiled module is told the types by the .d.ts and can give anything. What it imports is each function behind a door: every argument is read against its type into a value of the program's own, and a call with something else is refused in the caller before the function runs (packages/compiler/test/door.test.ts; The language says what is done with each kind of value). What is left on trust at that door:

    • The second name. A file of the language imports a function itself, under a name the .d.ts does not declare ($name). A TypeScript program that imports that name against its declarations goes round the door on purpose: it is not a caller that was wrong about a type.
    • The runtime library is a module like any other. A framework writes a cell with cellWrite, which reads the value against the type of the cell; cellSet, which the compiled program itself calls, does not read, and a program in JavaScript that imports it goes round the door on purpose, as with the second name.
    • A resource the outside drops is never ended: nothing can make a caller hand it back.
    • A regular expression with g or y is a RegExp for TypeScript, which accepts it; the door refuses it. TypeScript has no type for the flags of one.
    • What the engine throws in a function that was waiting (a stack that ran out after an await) stops the program one turn later than a panic does: another function that was waiting may go on in between.
    • A value nested thousands deep is read as deep as it is nested, on the stack of the engine: past a thousand or so it is refused, with that reason, though it may be of its type, and though the program may have given it. Data that goes out is frozen however deep it is; what holds a function, a Map or a Set thousands deep stops the program, as a recursion without end does.
    • Two programs in one engine tell their cells and their resources apart by the file that declares the type, its name, and a number made from the text of that file (31 bits, not a signature): two files of one name whose texts differ and give the same number would take each other's.
    • A function that takes any type takes any cell of it only from itself. A cell given out as a Cell<T> by one function is not handed to another function's Cell<T>: correct, and refused.
    • It costs: about 20 nanoseconds for each property that is read, at each call from the outside, and nothing between two files of the language. A value the program itself gave, frozen, is known again by the reader that read it once and is not read a second time; what holds a Map, a Set or a function is read each time. The compiler itself is called through its door: on its own sources compile takes the same time either way (495 ms and 530 ms), and analyse, which gives back every tree and type, about a tenth longer (439 ms against 387 ms). The fastest of thirty runs each, on a machine that was doing other work: an order of size, not a figure.
  • What stops the program stops it for good, whoever caught it. A panic, or a stack that ran out, in a function the outside called is thrown through the outside's own code, and JavaScript that wraps the call in a try goes on, as a web server does around a handler. From then on no exported function and no function handed to the outside runs again, and a call to the outside that comes back does not go on: each throws what stopped the program (outside.test.ts, door.test.ts). What is left on trust:

    • The stop is kept by the runtime library, for every program of the engine: two programs that share it stop together. What holds several (the compiler in a page that also runs what it compiled) runs one apart with apart.
    • startAgain of @strict-script/std starts a stopped program again. The language has no word for it; what runs programs (a test, a page that loads a module again) has.
  • An extern names what the module really has. What it declares as a type of the outside is not checked beyond « there is a value »: a wrong one is handed back to the outside, which throws, and that is an Err. The language never looks into such a value, so a wrong one is an error said late, not a value that differs from its type. Asking the outside whether it is of the class the extern names was looked at and left: it says the same error sooner, for classes only, and refuses a value that a library gives as an object of another class.

  • The runtime library, @strict-script/std, is written in TypeScript and is not under strict-ts: it is where exceptions are caught and values of unknown type are read. It is tested.

  • The effects ledger of strict-ts 1.0.0, for the functions of the platform that come with the language: the 41 functions of JavaScript the compiler calls with no Option and no Result around them are each one the ledger knows not to throw (packages/compiler/test/ledger.test.ts). The ledger proves ECMAScript only, and is not used for extern yet: a call to the outside gives a Result even where the ledger knows it cannot fail (SSC-12).

  • A text nested more than 100 deep is refused (too-deep), though it may be correct: the compiler goes down a text as deep as it is nested, on the stack of the engine, and a deeper one stopped it. What counts is a value in a value, a type in a type, a body in a body, and each link of some chains: a hundred else if, a hundred properties of properties, a hundred ??. Each of 26 ways to nest a text is a test (packages/compiler/test/deep.test.ts); on the stack Node gives by default the compiler gets through the deepest text it accepts with about a third of it. A chain of operations has no limit (a + b + c, a && b || c): the checker, the rules of ownership and what writes the JavaScript go along it instead of down it, and a sum of 20,000 terms compiles and runs. The engine itself goes down a chain whose operations are not all the same one, and runs out on a few thousand: a chain is written 500 operations at a time, each piece under a name. The other chains still cost a level for each link: with the limit taken off, the compiler stops after about 390 calls in calls, 470 else if, 800 properties of properties. Going along those too is not done: a long chain of else if is a match.

  • A compiler that does not get through a program refuses it (compiler-stopped, with no place). What no text shows can still stop it: a value built deeper with each of thousands of lines, an engine with little stack, a compiler called from deep inside another program. compile and analyse of @strict-script/compiler catch that stop, which the language itself has no word to do. The parser alone (@strict-script/self/parser) does not.

  • Every line of the compiler is run by a test (pnpm coverage, floor 100%), and that says less than it sounds:

    • A line that runs may hold a part that never does, and those are counted apart: 106 of the 7,555 lines (floor 98.5% run whole; COVERAGE_PARTS=all pnpm coverage lists them). 97 are the second side of a choice, most of them the fallback of a value ?? fallback whose value is always there (an argument after its count was checked): the language makes a program say what it does when a value is missing, even where it never is. The 9 others were looked at one by one, after the sides a program can reach were given a test (whole-lines.test.ts): what is left is a case no program reaches (a mistake asked whether it names a value, the place of ?? among the operators, which is written apart), or a wording for several parts at once. The 97 were not looked at one by one.
    • A part is what the engine reports as never run. Two tests that each take one side of a line, and never the two sides of two choices together, leave nothing to report.
    • Two kinds of lines are not counted: the guard the compiler writes after the last case of a complete match ($std.unreachable()), which no program reaches, and a line that only says } else {.
    • Some lines are run only by tests that call the compiler as a library on trees and types made by hand (kernel-units.test.ts, emitter-units.test.ts): what the emitter writes for a program that was refused, a case of an Option alone as a type. No program reaches them; the tests fix what they do.
    • A line that is run is not a line that is right: both reviews found their holes on lines the tests already ran.

#What is not built

  • A proof of the kernel: what is claimed rests on lists of known ways, on reviews and on a fuzzer.
  • A review by a person.
  • What The language lists as not in the language yet: a resource held inside another value, a collection that is shared and changed in place.
  • A release: nothing is published, and the language changes from one commit to the next.
Esc

    Type a word of the language, a rule, a command: mut, extern, match-not-covered.