Expand description
The bounded type oracle: what a node’s type is, and where its name came from.
This is the “bounded oracle” of the type-aware rules design, and the bound is depth
rather than the file. TypeScriptOracle answers from one parse and nothing else;
BuiltinProvider wraps it and follows an import out of that file — to a sibling source,
to a .d.ts, into node_modules — through the caller’s lanekeep_core::FileAccess, so
every file it opens is a recorded dependency of the answer. What it still has no notion of
is a program: no tsconfig.json, no path mapping, no compiler, and a fixed number of
hops rather than a transitive closure.
It answers None whenever it cannot be sure. That is the whole contract: a rule choosing
to be silent on None is sound, and one choosing to report on it is the author’s decision
rather than the engine’s.
§Why this is its own crate
It reaches declarations through lanekeep_lang::binding::BindingResolver::declaration_of
and lanekeep_lang::binding::BindingResolver::declares, two language-neutral questions,
so it never needs a language crate’s internals — lanekeep-lang-js is a dependency of its
tests alone. Only its knowledge of TypeScript syntax is language-specific, and that is
held in one type whose constructor refuses a grammar that does not speak it.
§What is deliberately absent
No clock, no environment, no randomness, no HashMap iteration, and no filesystem access
that is not a lanekeep_core::FileAccess read. A cached result computed by this oracle
must still be valid, so nothing here may observe anything the cache key does not cover: the
bytes it was handed, and the tracked reads it made from them.
Modules§
- tsc
- The
tscprovider: the project’s own TypeScript compiler, behindTypeProvider.
Structs§
- Builtin
Provider - The provider that reads declaration files with this crate’s own oracle.
- Declaration
- A declaration file this run has read and parsed.
- Export
Target - The file and name a chain of re-exports ends at.
- Query
- One question, with everything answering it needs.
- Symbol
- Where a name came from.
- Type
Script Oracle - A type oracle for one parsed TypeScript file.
- Type
Script Support - A grammar confirmed to speak TypeScript, and the resolver that goes with it.
Enums§
- Begin
RunError - Why a provider could not do its work — preparing a run in
TypeProvider::begin_run, or answering a question afterwards, whichTypeProvider::failurereports in the same shape. - Exported
- Where a file that declares an export sends the name it was asked about.
- Followed
- What following an imported name across the file boundary, as a type alias, found.
- Primitive
- A primitive type the oracle recognizes.
- Type
- What the oracle established about an expression.
Traits§
- Import
Resolution - What an oracle asks its host when a name comes from another file.
- Type
Provider - What answers
ctx.types.
Functions§
- declared_
here - The declaration of
nameat this file’s top level, exported or not. - declared_
name - The name a declaration node declares, when it declares one.
- find_
export - Where the file’s own file-level export named
nameleads. - oracle_
identity - What this oracle is, as a digest of every source file that decides an answer.
- resolve_
specifier - Resolve
specifier, written infrom, to a file inside the project root.