Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Duplicate identifier errors in a duplicate dependency system #378

Closed
basarat opened this issue Mar 29, 2016 · 6 comments
Closed

Duplicate identifier errors in a duplicate dependency system #378

basarat opened this issue Mar 29, 2016 · 6 comments

Comments

@basarat
Copy link
Member

basarat commented Mar 29, 2016

If a project has the following dependencies (typings.json):

"dependencies": {
    "ts-core": "github:redound/ts-core#dev-package",
    "ts-data": "github:redound/ts-data#dev-package"
  }

The issue is that the final resolution is like this:

├── ts-core
├─┬ ts-data
│ └── ts-core

A typings install creates a typings/main/definitions/ts-data/index.d.ts That has the ts-core declarations duplicated and this results in a bunch of errors.

Repro Steps

git clone https://github.com/redound/angularjs-kit
cd angularjs-kit
typings install
tsc

See errors in index.d.ts:
image

TIP: If you open the file in atom you see the same errors

PS: original report http://stackoverflow.com/questions/36282757/typings-duplicate-declarations

PS: I haven't investigated it much more and might be an issue with ts-data / ts-core setups. I just wanted to share general steps for repro 🌹

@blakeembrey
Copy link
Member

Most likely this is actually the main/browser issue and not the dependency tree. Dependencies are all namespaced correctly.

@unional
Copy link
Member

unional commented Mar 29, 2016

I think the issue is with ts-data using ts-core as dependencies and not ambientDependencies:
https://github.com/redound/ts-core/blob/development/build/ts-core.d.ts
It is an ambient module, but
https://github.com/redound/ts-data/blob/dev-package/typings.json#L6
use it as dependencies

@blakeembrey
Copy link
Member

Just looked into it, that's odd. It is actually being output in index.d.ts twice for some reason. There must be a reason why it things those paths are the different at different locations.

@blakeembrey
Copy link
Member

I think I see how it could occur, I'll look into creating a small reproduction and fixing it.

Edit: Confirmed. The imported check is per-dependency, so when an import is occuring from the top level and from internally it's been duplicated. Fixing it now.

@blakeembrey
Copy link
Member

Thanks for the report @basarat, I've got a solution and will push out a new patch with it.

@andevsoftware
Copy link

@basarat, @unional, @blakeembrey Thanks for helping out so quick, compiling without any errors now! Appreciate all the amazing work that's been done. Typings is a major (needed) improvement on the development workflow.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants