Repository navigation
📖🔧:make the API examples run as written - #120
Open
DerekNonGeneric wants to merge 1 commit into
Open
DerekNonGeneric wants to merge 1 commit into
DerekNonGeneric wants to merge 1 commit into
Conversation
Twenty-four examples in the API reference opened with `import util from '@openinf/util'`. The package has no default export, so the first line of each failed, under ESM and in TypeScript alike. The examples in util-core, util-number, util-date, util-object and util-types also imported through @openinf/util's re-exports, so they only worked for someone who had installed util as well. Every example now imports from the package that defines what it calls. The `and` example takes isPositive from util-number, since util-core has none. Two more could not run at all. The isAsyncGenerator example called `new` on the prototype of an async generator function, which is not a constructor, and the isBigIntObject example called the guard with no argument, which TypeScript rejects. Links from one package's reference to another's rendered with the package prefix as their text, and the isIterator link to isIterable did not resolve from @openinf/util at all. They now name what they point to. Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is> Assisted-by: Claude-Code:claude-opus-5
DerekNonGeneric
force-pushed
the
claude/project-thread-9bivk4
branch
from
October 13, 2026 21:12
84ef916 to
234a52f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by DerekNonGeneric
Before: 24 examples in the API reference opened with
import util from '@openinf/util'. The package has no default export, so copying any of them failed on the first line (does not provide an export named 'default'under ESM, TS1192 in TypeScript). Examples documented inutil-core,util-number,util-date,util-objectandutil-typesimported through@openinf/util's re-exports, so they only worked if you had also installed@openinf/util. TheisAsyncGeneratorexample threw (newon something that is not a constructor),isBigIntObject()was called with no argument, and cross-package links rendered as@openinf/util!Comparable, with theisIterator→isIterablelink not resolving from@openinf/utilat all (a TypeDoc warning).After: every example imports the names it calls from the package that defines them (
isNullfrom@openinf/util-core,isInt32from@openinf/util-number, and so on). Theandexample in util-core takesisPositivefrom@openinf/util-number, because util-core has no such guard. The two broken examples run and their↪results hold, and cross-package links read as the name they point to. TypeDoc's link warning is gone.How: the imports were rewritten by a script that looks up which package's
srcdefines each name. Everytsexample underpackages/*/srcwas then compiled against the built declarations and its↪claims run, the waylint:examplesdoes for READMEs. What still fails there is illustrative on purpose (the branding example's deliberate type error, DOM andTemporalexamples). Rebased ontomainnow that sdk#121 has landed, soor(isNull, isUndefined)compiles too. A patch changeset covers the shipped declarations.Summary by CodeRabbit