Skip to content

.d.ts modules keep a .d suffix in their FQN, so imports of them never resolve #507

Description

@zaebee

Found while measuring #506 (workspace-package imports, #504).

typescript_extractor.file_path_to_module_fqn strips the last extension only, so a declaration file keeps .d:

packages/types/Calendar.d.ts  ->  packages.types.Calendar.d

An import names the module without it — import type { Calendar } from "@calcom/types/Calendar" — so after #506 maps @calcom/types to packages.types, the candidate packages.types.Calendar still matches no node. On cal.com 28 FILE nodes carry the suffix, and most of the 288 @calcom.* imports #506 leaves unresolved are this — @calcom.types.Calendar alone is 79.

Fix direction

Strip .d.ts / .d.tsx as one suffix before the single-extension loop. This renames existing node ids, so a graph built before the change and read after it holds ids nothing produces any more; an incremental ingest must rebuild, the same way #506 rebuilds when the package map changes.

Also worth deciding: when both Calendar.ts and Calendar.d.ts exist in one directory the two would then share an id.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions