microsoft / microsoft/TypeScript

Duplicate identifier errors when using @types inside a Windows junction

Open
#36,294 12 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Domain: Module Resolution
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

This is a dupe of #11333, but that issue was marked as closed/fixed (and locked... why?). It's not. It should be reopened and actually fixed. It's also unrelated to 'npm link'.

IMPORTANT:

my e:\work directory is a JUNCTION point to y:\work

node: 13.5.0
npm: 6.13.4
tsc: 3.7.5

index.ts:

/// <reference path="node_modules/@types/youtube/index.d.ts" />

package.json:

{
  "name": "junction-bug",
  "scripts": {
    "tsc": "tsc index.ts"
  },
  "devDependencies": {
    "@types/youtube": "0.0.38",
    "typescript": "^3.7.5"
  }
}

NOTE: There is NO reference to 'y:' in any of my project's files, nor in any of npm's files. tsc is erroneously converting relative paths to absolute paths on the destination drive. look for references to y:\ in the output below:

e:\work\junction-bug>dir e:\ | findstr work
04/19/2016  09:02 AM    <JUNCTION>     work [y:\work]

e:\work\junction-bug>npm i
...
e:\work\junction-bug>findstr /s /i /c:"y:\\" *

e:\work\junction-bug>npm run tsc

> junction-bug@ tsc E:\work\junction-bug
> tsc index.ts

node_modules/@types/youtube/index.d.ts:16:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: UNSTARTED, ENDED, PLAYING, PAUSED, BUFFERING, CUED, InvalidParam, Html5Error, VideoNotFound, EmbeddingNotAllowed, EmbeddingNotAllowed2, AlwaysVisible, HideAllControls, HideProgressBar, NoAutoPlay, AutoPlay, UserDefault, ForceOn, ProgressBarColor, Hide, ShowLoadPlayer, ShowDelayLoadPlayer, Enable, Disable, Show, ListType, ListTypePlayer, ListTypeSearch, ListTypeUserUploads, SinglePlay, Loop, Full, Modest, Fullscreen, Inline, SuggestedVideoQuality, VideoQualityDefault, VideoQualitySmall, VideoQualityMedium, VideoQualityLarge, VideoQualityHD720, VideoQualityHD1080, VideoQualityHighRes, Player

16 declare namespace YT
   ~~~~~~~

  y:/work/junction-bug/node_modules/@types/youtube/index.d.ts:16:1
    16 declare namespace YT
       ~~~~~~~
    Conflicts are in this file.

y:/work/junction-bug/node_modules/@types/youtube/index.d.ts:16:1 - error TS6200: Definitions of the following identifiers conflict with those in 
another file: UNSTARTED, ENDED, PLAYING, PAUSED, BUFFERING, CUED, InvalidParam, Html5Error, VideoNotFound, EmbeddingNotAllowed, EmbeddingNotAllowed2, AlwaysVisible, HideAllControls, HideProgressBar, NoAutoPlay, AutoPlay, UserDefault, ForceOn, ProgressBarColor, Hide, ShowLoadPlayer, ShowDelayLoadPlayer, Enable, Disable, Show, ListType, ListTypePlayer, ListTypeSearch, ListTypeUserUploads, SinglePlay, Loop, Full, Modest, Fullscreen, Inline, SuggestedVideoQuality, VideoQualityDefault, VideoQualitySmall, VideoQualityMedium, VideoQualityLarge, VideoQualityHD720, VideoQualityHD1080, VideoQualityHighRes, Player

16 declare namespace YT
   ~~~~~~~

  node_modules/@types/youtube/index.d.ts:16:1
    16 declare namespace YT
       ~~~~~~~
    Conflicts are in this file.


Found 2 errors.

Related Issues: 113333

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 provided index.ts and package.json in a Windows project where e:\work is a junction to y:\work, then run npm install and npm run tsc. Trace how the compiler resolves the referenced node_modules/@types/youtube/index.d.ts and verify that the same file is not reported under both paths; done means the duplicate identifier errors no longer occur.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
compilers, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.