(sourceFile: SourceFileInfo & { dependents?: readonly string[] | undefined; }, modulePath: string, checker: TypeChecker, options: ModuleSourceOptions, diagnostics: ({ ...; } | ... 12 more ... | { ...; })[], program: Program, virtualFile: SvelteVirtualFile): ModuleAnalysis | undefined Analyze a Svelte module using checker-backed analysis.
Requires the svelte2tsx virtual output to be included in the TypeScript program
(via createAnalysisProgram({ virtualFiles })). Provides full type resolution for:
- Imported prop types (let {x}: ImportedProps = $props())
- <script module> exports (constants, types, re-exports)
- Star exports and re-exports from Svelte files
sourceFile
the original Svelte source file
SourceFileInfo & { dependents?: readonly string[] | undefined; }modulePath
module path relative to source root
stringchecker
TypeScript type checker (from the program containing virtual files)
TypeCheckeroptions
module source options for path extraction
diagnostics
diagnostics collector for non-fatal issues
({ symbolName: string; file: string; message: string; severity: "error" | "warning"; kind: "type_extraction_failed"; line?: number | undefined; column?: number | undefined; } | { functionName: string; ... 5 more ...; column?: number | undefined; } | ... 11 more ... | { ...; })[]program
TypeScript program containing the virtual file
ProgramvirtualFile
pre-transformed virtual file data
returns
ModuleAnalysis | undefined module analysis with declarations, re-exports, and star exports;
undefined if the virtual file is not found in the program