Skip to main content

Crate lanekeep_types

Crate lanekeep_types 

Source
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 tsc provider: the project’s own TypeScript compiler, behind TypeProvider.

Structs§

BuiltinProvider
The provider that reads declaration files with this crate’s own oracle.
Declaration
A declaration file this run has read and parsed.
ExportTarget
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.
TypeScriptOracle
A type oracle for one parsed TypeScript file.
TypeScriptSupport
A grammar confirmed to speak TypeScript, and the resolver that goes with it.

Enums§

BeginRunError
Why a provider could not do its work — preparing a run in TypeProvider::begin_run, or answering a question afterwards, which TypeProvider::failure reports 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§

ImportResolution
What an oracle asks its host when a name comes from another file.
TypeProvider
What answers ctx.types.

Functions§

declared_here
The declaration of name at 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 name leads.
oracle_identity
What this oracle is, as a digest of every source file that decides an answer.
resolve_specifier
Resolve specifier, written in from, to a file inside the project root.