Files
codegraph/__tests__
Colby MchenryandClaude Opus 5.5 458ad51921 fix(ts): a type a module doesn't import is never another module's (#2736)
A TypeScript module reaches another module's type only through an import,
so a type it names without importing it is its own or a global one: a
script's top-level declaration or one in a declare global block. #2726
held a supertype to that. A type annotation, a type argument and a type
alias's value went to the name matcher like any other name, which handed
them a project type of that name: vscode's Omit<...> annotations reached
quickInput.ts's export type Omit instead of TypeScript's own, and type
parameters and mapped keys, like excalidraw's <Point extends ...> and
frontend's <T>, reached other modules' types and enum members.

Both name-match strategies now leave out another module's non-global type
for a TS or JS module's type reference to a name the file doesn't import,
ahead of the ranking, so a declare global type still wins over a nearer
module's namesake. Left as they were: the last name of a qualified type,
vscode.TextDocument, written after a dot; a name inside a declare module
'x' block, which is module x's own; and a name an import X = ns.X alias
binds, which the file's import list doesn't hold.

Globals come from declaration files and declare global blocks. A script
.ts's top level is a sample's or a fixture's, global to its own program
only (vscode's colorize fixtures declare type T), and a test's or
fixture's globals reach its tests only, as its declare module blocks do.
That holds for supertypes too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 08:34:49 +00:00
..