TypeScript and JavaScript
Knossos scans .ts, .tsx, .mts, .cts, .js, .jsx, .mjs and .cjs files, plus .vue, .svelte and .astro components, with the TypeScript compiler's own symbol resolution. Imports, calls, types, inheritance and project references come from the compiler and are the primary facts. On top of them the worker layers a bounded set of application conventions. Their facts carry framework_convention provenance. An edge is certain unless the worker had to infer which declaration code reaches (see Dispatch the checker cannot resolve); the framework roles Knossos derives from them are probable, and certain for NestJS.
No framework module is imported and no bundler or application is started.
Framework and application conventions
- Next.js App Router
pageandlayoutexports, HTTP exports inroutefiles, route-group path removal, and function-level"use server"actions. - React function/class components in JSX files,
useXhooks, and compiler- resolveduses_hookedges. - Vue
defineComponentvariables anduseXcomposables in Vue-oriented TypeScript modules. - A
uses_hookedge names its framework,reactorvue, by what the file declaring the hook imports, or failing that what the calling file imports. AuseX()call with neither in scope is an ordinary call. - Pinia/Redux/Zustand-style
defineStore,createStore,configureStore, andcreatefactory declarations. fetchandaxios.get,post,put,patch,delete,headandrequestcalls with a literal URL or a template literal asendpointnodes andcalls_endpointedges, including a staticmethodoption onfetch. Each substitution in a template literal becomes{}, and the core joins the endpoint to the route that serves it, as from request to handler describes.- Requests through an axios instance. An instance is recognised only from
axios.createon a binding imported from"axios", in the same module or an imported one. A relative literalbaseURLis joined to the request URL with exactly one slash, and an absolute request URL ignores it. A missing, absolute or computedbaseURLgives an endpoint with an unknown prefix.request({ url })without amethodis aGET, and a method that is not a literal gives an endpoint with methodANY, as it does onfetch. The directaxiosimport readsget,post,put,patch,delete,headandrequestthe same way, and an instance exported as the default is recognised too. - NestJS, described below.
- A leading shebang marks the module
executable, which keeps a script a shell runs (and that nothing therefore imports) off the dead-code report. - So does a main guard at file scope:
import.meta.main,require.main === module, orimport.meta.urlcompared withprocess.argv[1]. The guard may stand behind a conjunct (process.argv[1] && ...) or in aconsttheifnames (const isMain = ...; if (isMain)). Alet, a negated guard and an||do not count. - A method or arrow property of an object literal handed to a typed parameter is marked
overrideswhen that parameter's type declares a member of the same name, as a library's options type does (express.static(root, { setHeaders })). The library calls it, so nothing in the project does. Each part of a union counts on its own, so an optional parameter (Options | undefined) and a loader-or-options one (defineAsyncComponent) are read too. - A
.jsor.cjsfile with no import, export,requireormodule.exportsis a classic script, loaded by a<script>tag or run by Node, and isexecutabletoo: nothing can import anything from it. - A module that exports nothing and calls something at its top level (
seed();,main().catch(...),await start()) is run rather than imported, bynode scripts/seed.jsor as a bundler's entry, and isexecutabletoo. Anyexport, ormodule.exportsorexportsnamed anywhere in the file, rules it out. - A
jsconfig.jsonis read as a tsconfig is, with the defaults TypeScript gives a jsconfig (JavaScript allowed): itsbaseUrlandpathsresolve a JavaScript project's bare imports, such ascheckout/components/Searchunder"baseUrl": "src", extensionless Vue components included. Ajsconfig.*.jsonvariant is read as a plain tsconfig. A jsconfig beside atsconfig.jsonis left out, as TypeScript's own tools leave it out, and the JavaScript of dependencies is never read. - A file no tsconfig includes is read under fallback options: the module resolution options of the config nearest to it, without its
strict,libortypes. Which globals and type libraries the project loads is unknown there, so an error that a name or type library is missing (Cannot find name '__dirname', the hint to install@types/node, a/// <reference types>that is not installed) is left out. A missing module, a type error and a grammar error are still reported. An option error that names no file is not reported for these files: the fallback options are partly made up by the scanner, so the error would not be about your config. The config'signoreDeprecationscomes along with its resolution options, so a deprecation you silenced stays silent here too. When the project has a tsconfig and none of them includes the file, the file is part of no TypeScript project: every diagnostic on it is reported asinfo, marked "not part of any TypeScript project", so it does not count toward the project's errors. A config mounted into a container is one such file: what it imports exists only where it is compiled. A file with errors also gets aninfodiagnostic,TS_OUTSIDE_EVERY_PROGRAM: the project's own typecheck (tsc -p,vue-tsc) never sees those errors. Anincludeof**/*.mtsskips dot-directories such as.vitepress/, another usual cause. In a project with no tsconfig at all, errors stay errors. - A config that sets no
typeRootsloads its implicit type libraries from everynode_modules/@typesfrom the config's directory up to the scanned root, astscdoes. An@typesdirectory above the root is not read. - A module importing
k6ork6/*is a k6 load-test script: it isexecutable, and its default export,setup,teardown,handleSummaryand every function a scenario names as itsexecare markedruntime_invoked, since k6 calls them and nothing imports them.
NestJS
Imports from @nestjs/* switch the NestJS collector on for a file. Its roles are certain. Decorators count whether they are imported by name, renamed, or through a namespace import (@nest.Get() after import * as nest); one re-exported from a module of the project does not.
@Controller,@Injectableand@Moduleclasses get thenestjs.controller,nestjs.providerandnestjs.moduleroles.@Get,@Post,@Put,@Patch,@Delete,@Head,@Optionsand@Allmethods on a controller becomeroutenodes, with the controller's literal prefix joined to the method's path.app.setGlobalPrefix("api", { exclude: [...] })becomes asettingnode with the prefix and the literal excluded paths. The core puts the prefix in front of every NestJS route whose path is not excluded. A prefix that is not a literal, or two applications in one project with different prefixes, leave the routes' prefix unknown.- The
imports,controllers,providersandexportsarrays of@Modulebecomedepends_on,containsandexportsedges to the classes they name. - Methods that Nest calls itself get the
nestjs.framework_handlerrole: the lifecycle hooks (onModuleInit,onApplicationBootstrapand the other three),canActivate,intercept,transform,catch,use, the gateway methods (handleConnection,handleDisconnect,afterInit), a Passport strategy'svalidate, and methods decorated with@Cron,@Interval,@Timeout,@OnEvent,@EventPattern,@MessagePattern,@Process, the queue event decorators,@OnWorkerEventor@SubscribeMessage.
Edges
The worker reports every site; the core collapses repeated edges (see Repeated edges). Mixed type/value imports or re-exports retain type_only_variants so the collapse does not erase that distinction.
An import of something outside the project targets a package node named after the package: lodash for lodash/fp, @scope/pkg for @scope/pkg/sub. A Node built-in is one package with or without its node: prefix (node:fs and fs are both fs, and _http_agent too, though npm would not publish that name); one Node only offers under the prefix, such as node:test, keeps it. Which names are built-ins is Node 24's list, whatever Node runs the scan. A specifier that resolves to nothing gets no edge when a tsconfig paths key or a bundler alias covers it (@app/missing under @app/*; a catch-all "*" key does not count, since it covers every name; an alias that resolves into a dependency, such as vue aliased to vue/dist/vue.esm-bundler.js, is still that package), or when it could not be an npm package name, such as an alias your tsconfig does not know (@/components, ~/stores): it names your own code, not a dependency, and in a file it type-checks the compiler reports it as a missing module.
Dispatch the checker cannot resolve
Two call shapes reach project code that the compiler resolves to nothing.
Lookup tables.
STEP_HANDLERS[step.do](step, ctx)picks a function out of an object literal that aconstbinding holds, in the same module or imported. With a key only the run time knows, the lookup references every function or method the literal holds, aspossible. A literal key,STEP_HANDLERS['wait'], references only the entry it names, ascertain. The fan-out is not capped: a computed key into a table of any size references every entry, since dropping the edges would leave each entry looking unused.Destructured parameters.
async hold(step, { tape }) { await tape.hold() }in plain JavaScript leavestapeuntyped, sotape.hold()resolves to nothing. When a call hands that function an object literal,{ tape }or{ tape: recorder() }, the value's type stands in for the binding's: each method call on the binding the checker could not resolve becomes aprobablecallsedge (attributeinferred_from: call_argument) to that member, when the member is declared in your project. The call can be in the same file or in any other file of the same program, and reach the function directly, through a named or default export, through a re-export (anindex.jsthat doesexport { hold } from './steps.js'), or through a lookup table, imported or not. A parameter with a declared type, a TypeScript annotation (({ tape }: Context)), a JSDoc@param, or an annotation on the binding the function is the value of (const hold: Step = ({ tape }) => ...), already types the binding: its calls staycertain, with no inferred edge beside them, and a call into it from another file is not followed at all. An argument that comes after a spread,hold(...steps, { tape }), is not read, since the spread decides which parameter it lands in.When several call sites hand the function different values, the method call reaches the member of each one, however many there are: the count is bounded by the call sites in your source.
A call in another file is followed when its callee's name can reach such a function: a name it is declared under, or one an import, export or
requirerenames it to (import { hold as h }, a default import,export { hold as keep } from,module.exports = holdorexports.hold = holdbound byconst h = require('./steps')orconst { hold } = require('./steps')). Only files the same program describes take part: a file anothertsconfig.jsonlists is described by that config's program, so its calls give a function of this program nothing. A CommonJS function expression,module.exports = function ({ tape }) {}orexports.hold = function ({ tape }) {}, has no node of its own, so its inferred calls come from the node its body's other calls come from: its module, or the declaration it sits in.The edges belong to the function's own file, so that file's facts follow the files whose calls typed the binding: its contribution lists each of them among its reads. Editing such a caller rescans the function's file, and deleting it rescans every TypeScript file, so the edge follows the new argument or disappears. A file that starts handing a function of another file a literal is named by none of those reads yet, so which file hands which a literal is part of the program's environment: when that set changes, every file of the program is rescanned, as when a global script changes. A call into a typed function is no such pair and rescans nothing beyond its own file.
When the same edge is found more than once, the surer confidence wins: handlers[key] and handlers['ping'] in one function make the reference to ping certain.
Declarations
Besides classes, interfaces, enums, type aliases, namespaces, functions and methods, a module-level binding whose value is an arrow or function expression is a function node: const f = () => {}, let f = function () {}, through parentheses, as and satisfies. It carries binding (const, let, var, using or await using), is the source of the calls in its body, and is the target of calls and references to it. A binding inside a function or block, or one whose initializer wraps the function in a call (memo(() => ...)), is not a node.
exported and default on any variable binding are read from its statement, so export const api = { ... } is exported.
Components
.vue, .svelte and .astro files are scanned as TypeScript. The worker reads each one into position-preserving virtual source: script blocks (and Astro's frontmatter and bundled <script> elements) keep their bytes, template expressions and component tags are written back where they stand, and everything else is blank. Line and column numbers are therefore the component's own, and an import of ./Card.vue resolves through relative paths, paths and baseUrl like any other module.
- A helper, store or child component used only from a template has its edge.
- In an
.astrofile,Astro.propshas the component'sPropstype, as Astro's own tooling gives it, so fields read from it are not typed from their destructuring defaults. - In a
.sveltefile, the runes ($state,$derived,$props) are typed by the installedsveltepackage, as svelte-check types them, and in a SvelteKit+page.svelteor+layout.svelte,$props()givesdatathe type the route's generated./$typesdeclares. - A generic component's type parameters (
<script lang="ts" generics="T extends …">in Svelte,generic="T"in Vue) are declared, each standing for its constraint. - These declarations (the route's
$props, the type parameters, Astro'sAstro) are written nowhere in your file, so they are no nodes and nothing refers to them, and no fact of a component stands past its last line. What they imply stays: Astro readsPropsby name, so the component still references it. - A component's default export is the component its bundler compiles, which its source never writes (
<script setup>, Svelte, Astro): importing it, re-exporting it or destructuringdefaultfromawait import('./X.vue')is not reported as an error. - A file no tsconfig
includecovers (a package's tests, a nested tools package) is read with its package's paths, aliases and project references, under the TypeScript and installed types of the package it sits in, and with a bundler's resolution as its test runner uses. Every such file of the package is in that program, whichever of them a scan or a batch happens to read, so an ambientdeclare module 'x'in the package's declaration files satisfies the import, a test sees the globals its setup file declares, and an incremental scan of one such file reads it as a full scan did. - A template name that resolves to nothing (an Options API method reached through the component instance) is listed in the module's
unresolved_member_calls, so a method by that name is only possibly dead. - A Vue Options API component (
export default { … },defineComponent({ … })): the hooks Vue, vue-router, vue-meta and Nuxt call (mounted,data,beforeRouteEnter,metaInfo...), watchers and propdefault/validatorfactories are marked as called by the runtime, and a method or computed property the component names throughthis.x, its template or a watcher string gets a reference. - Under a
package.jsonthat depends onvue, an extensionless import (./components/Card) that resolves to nothing else resolves toCard.vue, as webpack and Vue CLI do. require('./x')in a component script withoutlang="ts"imports what it names, as it does in a.jsfile.- Module aliases a bundler declares in
vite.config.*,webpack.config.*,webpack.mix.js,vue.config.jsorsvelte.config.*(including SvelteKit's$lib) apply when no tsconfigpathsmaps the same name. Only targets that can be read without running the config count: a string,path.join|resolve(__dirname, …), orfileURLToPath(new URL('./x', import.meta.url)). - The module roots a webpack config lists in
resolve.modules, or Vue CLI'schainWebpackadds withconfig.resolve.modules.add(…), resolve bare imports such ascheckout/components/Searchundersrc. As webpack does, a root listed beforenode_modules(or added with.prepend) is tried before packages, unless a tsconfig maps*itself, and a root after it (or added with.add, after Vue CLI's defaults) only once no package answers. A root is a directory name orpath.join|resolve(…), read against the config's directory; webpack looks a directory name up in every parent directory, as it doesnode_modules, so a nestedsrcelsewhere is not a root here. Any other value is not run, and aBUNDLER_CONFIG_UNREADwarning names the config and the key. A component extension inresolve.extensions(.vue,.svelte) resolves extensionless imports of that kind; an extension that cannot be read is skipped. - A webpack config under another name is read when the project says where it is: the file a
package.jsonscript passes webpack with--configor-c(webpack-dev-server --config build/webpack.dev.conf.js), and every config one of those requires or imports by a relative path whose file name containswebpack(a base config it merges,require('./webpack.base.conf')). Such a config is read even under a directory discovery leaves out, such asbuild/, and an edit to it marks the graph stale. In a config outside the program's directory,__dirnamenames that config's own directory, and a path without it is read against the directory the script runs from. A helper module a config requires (require('./utils')) is not read as a config. - webpack's
require.context('./dir', recursive, /pattern/)imports every module in the graph it matches. The match happens when the graph is assembled, so an incremental scan that re-reads only the loading file keeps every edge. - Vite's
import.meta.glob('./Pages/**/*.vue'), a single pattern or an array, imports every module its patterns match, the same way, reading a relative pattern from a literalbaseoption and matching*,**,?,{a,b}and[ab]. A negated pattern ('!./x.vue') is ignored, so it can keep a module it excludes live but never drops one. - SvelteKit route components (
+page.svelte,+layout.svelte,+error.svelte) and Astro pages (src/pages/**/*.astro) are entry points. - A component that cannot be delimited, or whose script is
lang="tsx"orlang="jsx", keeps its module node and reportsCOMPONENT_UNPARSED. - Every component is a module, with its compiled component as the default export, whatever its script declares.
Not handled: Nuxt auto-imported components and file-based routing, globally registered components, Vue template type semantics (slot props, $emit names, v-model modifiers), .mdx and Markdown pages.
Limits
Dynamic route segments stay in their source spelling, a request URL that is only substitutions is omitted, a URL starting with a substitution keeps an unknown prefix, and framework roles never override a language symbol kind. A NestJS route whose decorator argument is not a literal gets an empty segment rather than a guessed one.
Compiler diagnostics
Compiler errors that name a file are attached to that file. A scan builds only the programs whose files it reads, and type-checks each of them whole, in program order, before reading any facts, so for the same bytes a file's facts and diagnostics are the same whether a scan reads it alone or with the rest of its program. An option error that names no file, such as a deprecated moduleResolution value, or a global type your lib lacks, appears once per program, on the program's first file in path order, and its message says it applies to the whole program. That file is the same however your files are batched, so an incremental scan that does not touch it neither repeats nor drops the diagnostic. An option error says which config sets the option ((set in tsconfig.json)), and a program whose config only inherits it through extends from another config this scan builds leaves it to that config's program, so it is reported once. Knossos checks with the TypeScript it bundles, which may be newer than your project's: a deprecation is reported as a warning, and says which version deprecated it, since your own compiler may not. If a deprecation is not worth acting on yet, you can silence it with "ignoreDeprecations" in your tsconfig.json. A global type the compiler only looks for while checking one file's code (IterableIterator for a generator under an ES5 lib) is not reported: an edit to that file would not rebuild the file the diagnostic sits on. A compiler budget running out (TS2589, TS2590, TS2321, TS7056) is reported where the whole program's check runs out.
One limit follows from the compiler's instantiation cache, which the whole program shares: an edit to one file can change whether a budget runs out in a file that does not import it. Removing an instantiation from a.ts that warmed the cache can make b.ts report TS2589 and resolve a type differently (a references edge to Array, say). An incremental scan rescans a.ts but not b.ts, so b.ts keeps its earlier facts and diagnostics until a full scan (--mode=full) settles them. Rescanning every file on every edit would be a full rebuild. A program the compiler cannot build or check at all reports TS_PROGRAM_FAILED for its files and costs no other program's facts.
Processes it starts
spawn, spawnSync, execFile and execFileSync with an interpreter ("node", "python3", process.execPath) and an argument array, fork(path), and an array that reads as an argv link the code to the file the process runs, with a probable launches edge to that file's module. A path is a string literal or the literal it is joined from (a template literal, +, path.join/path.resolve, new URL("./a.js", import.meta.url)); a name with no directory counts only with a script's extension. The core resolves the path to the module of the project file at that path, or of the one file whose path ends with it, and drops the edge when there is none.