Skip to content

TypeScript path aliases ignore fallback targets after the first #1531

Description

@oleksii-tumanov

Context

Reproduced on v8 at 12193a8. TypeScript compilerOptions.paths values are ordered fallback lists, but Graphify keeps only targets[0]. If that substitution is missing while a later one exists, the import edges target the missing path and are dropped during build.

Related to #147. The open #927 handles wildcard pattern matching; this case is only about target fallback order.

Reproducer

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "$lib/*": ["generated/*", "src/lib/*"]
    }
  }
}

Only src/lib/types/type-helpers.ts exists:

// src/routes/page.ts
import type { Helper } from '$lib/types/type-helpers'

Current behavior

Relevant extract() output, path-sanitized:

{
  "source": "src_routes_page",
  "target": "<project>_generated_types_type_helpers",
  "relation": "imports_from",
  "context": "import",
  "confidence": "EXTRACTED",
  "source_file": "src/routes/page.ts",
  "source_location": "L1"
}

JS/TS files bypass the AST cache, so this extraction does not produce a graphify-out/cache/ast/... entry.

Expected

Try each configured target in order until one resolves. The example should target src_lib_types_type_helpers; if both targets exist, the first should still win.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions