Five small holes closed: imports the transform writes, tsconfig flags, every any the library hands out, a g regex tested again (regex-last-index) #142
Loading…
Reference in a new issue
No description provided.
Delete branch "small-gaps"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Based on
shared-copies(#141), and contains it: the diff shown is this piece alone.Five small holes, each confirmed on the binary before anything was built. Four came from an outside audit of
main; the transform bug turned up while reviewing #140. Each of these passestscstrict,safe-ts check --idiomatic --deny-warningsand oxlint, except the first, which does not build at all:What changes
The transform's added imports parse for every shape of an import of std.
q,match,parseJson/validateandarbitrarywrite their ownimport { … }statement in front of the import std was found through; they no longer paste names into its text. A test transforms thirteen shapes (namespaces, a default with braces,import typenext to a value import, two imports of one module, the prelude with no import) and type-checks each.A setup warning for each compiler flag a guarantee depends on.
strictleft off, each of its members set tofalseon its own, andexactOptionalPropertyTypesleft off, followingextends. Each is tied to a program in the tests: accepted bytscwith the flag off, refused with it on, silent insafe-ts check, and wrong when it runs. The adoption guide has the table.Every
anyTypeScript's declarations hand out is accounted for. A test reads the lib files of the documented setup and Node's types and lists each member where code receivesany: 962 of them. Each must be in one of three places, or the test fails, so a TypeScript upgrade that adds one shows up:Object.getPrototypeOf,Object.values/entriesof a type without an index,Object.assignof four sources, property descriptors,Reflect.apply/construct, the callbacks ofJSON.stringifyandreplace, aPromiseLike's rejection reason;no-hidden-any(31), which now follows the receiver however it is written:controller.signal.reason, a field, an element, a map's value, a call's declared return type, and a value typedOption<T>;=> anyis what the code's own handler may return.New rule
regex-last-index(error, with a quick fix).testorexecon a regex withgoryrun again with thelastIndexthe last call left: a field used in a method, a local in a loop over other strings, in a callback. The idiom the flag exists for (while ((m = re.exec(text)) !== null)over one string),matchAll,replaceandsplitare silent.Measured and left:
toISOString()on a date made from a number. On an adopter's project all eight such sites take their time from a clock. A number that came from parsing is already reported; what is left is "who made this date", which a rule reading one function cannot answer. The gap is written down in the builtins guide and as an escaping class in the corpus.Evidence
q, a mapper andmatch; a renamed import next to a namespace; a file without semicolons. Each emits a program that runs and gives the right answers.regex-last-index: 9 of 9 forms reported, 8 fine forms silent.any: 12 of 12 reads refused bytscor reported; the typed overloads still work.no-hidden-anyreceivers: 21 of 22 forms reported, 5 reads of a project's own field with the same name silent. The one not reported at the read is an optionalCustomEventfield, which is reported where its type is written.extendswith comments stay free of warnings.verbatimModuleSyntaxorerasableSyntaxOnlyis off. I had those taken out: what they prevent is a module that fails to load under Node's own type stripping, which is loud, and this repository's own docs use parameter properties, which one of them refuses. They are now a recommendation for code Node runs itself. The first version ofno-hidden-anyalso read its table only off an annotated binding, so the commonest read of a signal's reason, through its controller, was silent; the second sawAbortSignal | undefinedand notOption<AbortSignal>, the spellingprefer-optionasks for..reasonreads are all of its own types.lib-any-reaches-code,regex-last-index-reused), one added and left open on purpose (date-from-unchecked-number). 17 of 108 escape.What turns red on upgrade
tscrefuses reads it used to let through asany. The changelog lists each retyped member with what to write: giveObject.values(x)aRecordtype first; annotate or check areplacecallback's captures; compare or check whatObject.getPrototypeOfgives.regex-last-indexis an error. Drop the flag wheretestis the only use (the quick fix), or setlastIndex.strictoff, one of its members off, orexactOptionalPropertyTypesoff gets a setup warning, which--deny-warningscounts.For the owner to decide
verbatimModuleSyntaxanderasableSyntaxOnly. Requiring them means rewriting seven docs examples and 22 fixture lines that use parameter properties, and a warning for every project on today's documented setup.skipLibCheck. With it on, a declaration that imports a missing package is silentlyany, a real hole. But nearly every scaffold turns it on, and turning it off reports errors in third-party declarations a project cannot fix. Left out of the warnings.stream.on("data", (chunk) => …)hands outany, and the strict lib cannot retype Node's declarations. The adopter has 27 such calls; the checker could type the receiver at 5, and 25 of the 27 annotate the chunk: Buffer, a claim nothing checks. A finding would ask forawait text(stream)fromnode:stream/consumers, or(chunk: unknown)with a check. Nothing built.What stays unseen
no-hidden-any: a receiver narrowed by a test, what a lib function returns (AbortSignal.timeout(ms).reason), a package's value, a table property called through such a receiver, and a generic alias of a list of such values.regex-last-index: flags that are not written where the regex is made.Created with Claude Opus 5.5 (implementation) and Claude Fable 5.2 (review and acceptance tests) in Claude Code.