microsoft / microsoft/TypeScript

d.ts type imports are not resolved correctly in dependencies

Open
#40,581 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs Investigation
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

TypeScript Version: 4.1.0-dev.20200915

Search Terms:

path module resolution

Code

Please check this repo: https://github.com/dkjii-g/tsc-ref-bug

Check the README for bugs/instructions.

Expected behavior:

  • The 4 folders compile correctly (they are slight variations to better explain the bug - you don't have to check them all).
  • Typescript should not use the current project's module resolution when importing a different project's definitions.

Actual behavior:

Typescript tries to import repo2's modules from repo1's project.

This prevents the compiler from finding the type definition in dependencies.

Related Issues: #38111 #39117 (not sure)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the README in the linked tsc-ref-bug repository and run its four folder variations, focusing on the cases where repo2 imports are resolved from repo1. Compare the expected and actual compiler behavior, then confirm that dependency definitions resolve using the dependency project's module resolution rather than the current project's.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.