-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate identifier error when dependent project supplies its own type definitions for a shared library #10968
Comments
I can't reproduce this using the latest compiler version. Looks like a duplicate of #9771? |
I can still repro with the above repro steps. Here's a simpler repro: Here are easier steps:
Here's all my output with the errors at the bottom. Note the specific versions
|
Ah, by "latest compiler version" you meant the nightlies, not version 2.0.2. Looks like this was fixed on 8/26, which included merge #10354.
However, the bug still repros in version 2.0.2, which is the original milestone for the bug #9771. Is it possible to get this backported to hit the official 2.0 release? Us folks at Tableau really want TypeScript 2 goodness, but we need this fix, and we're too conservative to be using nightly builds for our core modules. |
[default] Checking started in a separate process... |
2.0.5, which will the official 2.0 release, will have this fix |
Just saw that 2.0.3 was released, but looks like the fix is not in there yet. :(. Will have to wait for 2.0.5 |
Fix should be in the 2.0.5 |
Yep, looks like it's there:
|
Workaround: include the new path mapping option to explicitly state the For example, in this repro you would add this to {
"compilerOptions": {
"baseUrl": ".",
"paths": {
"react": ["./node_modules/@types/react/index"]
}
}
} Then run |
I have similar issue with jquery and knockout. node_modules@types\jquery\index.d.ts(623,5): error TS2374: Build:Duplicate string index signature. |
@mKlus please file a new issue and give us more info to be able to diagnose the issue you are running into. |
In case someone encounters and everything doesn't work. I had to manually specify exclude and typeRoots in new tsconfig.json, not sure if it is a bug or intended behavior. {
"exclude": [
"node_modules",
"out"
],
"compilerOptions": {
"typeRoots": [ "./node_modules/@types" ]
},
"extends": "../library/tsconfig.json"
} |
I've fixed my problem with this workaround |
TypeScript Version: 2.0.2
npm install @types/react
The problem: I get a "duplicate identifier" error when compiling proj2:
'react'
to proj2'sproj2/node_modules/@types/react
. All good.'react'
toproj1/node_modules/@types/react
which would be fine, and hits the duplicate identifier errorSimplified Repro:
cd bugreport/proj1
./node_modules/.bin/tsc
cd ../proj2
./node_modules/.bin/tsc
Expected behavior: succeeds. All is good.
Actual behavior:
How are we supposed to handle these situations where a dependency brings its own type definitions for a shared library?
The text was updated successfully, but these errors were encountered: