-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: 2.0.2
- I have two directories containing typescript projects: proj1, proj2.
- Both projects depend on React, and definitions are installed for each through
npm install @types/react
- They compile independently.
The problem: I get a "duplicate identifier" error when compiling proj2:
- when the compiler processes a proj2 file it resolves module
'react'
to proj2'sproj2/node_modules/@types/react
. All good. - when the compiler processes a proj1 file it resolves
'react'
toproj1/node_modules/@types/react
which would be fine, and hits the duplicate identifier error
Simplified Repro:
- Unzip bugreport.zip
cd bugreport/proj1
./node_modules/.bin/tsc
cd ../proj2
./node_modules/.bin/tsc
Expected behavior: succeeds. All is good.
Actual behavior:
../proj1/node_modules/@types/react/index.d.ts(7,21): error TS2300: Duplicate identifier 'React'.
index.ts(4,17): error TS2345: Argument of type 'typeof Proj1Comp' is not assignable to parameter of type 'ReactElement<{}>'.
Property 'type' is missing in type 'typeof Proj1Comp'.
node_modules/@types/react/index.d.ts(7,21): error TS2300: Duplicate identifier 'React'.
How are we supposed to handle these situations where a dependency brings its own type definitions for a shared library?
chriszrc, NN---, bamtron5 and rosskevin
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue