npm link unusable with peer dependencies

triaged
cli
priority:high

(Markus) #1

What I Wanted to Do

Develop an app with linked dependencies that contain peer dependencies.

Background: We have generated code with peer dependencies for our API-clients. The generator (https://github.com/OpenAPITools/openapi-generator) creates peer dependencies for angular and rxjs but the generated versions don’t match our versions.

What Happened Instead

ERROR in src/app/access-tt/ticket-detail/correction-change-log/correction-change-log.component.ts(35,22): error TS2345: Argument of type 'Observable<CorrectionChangeLogEntry[]>' is not assignable to parameter
of type 'Observable<CorrectionChangeLogEntry[]>'.
  Types of property 'source' are incompatible.
    Type 'Observable<any>' is not assignable to type 'Observable<any>'. Two different types with this name exist, but they are unrelated.
      Types of property 'source' are incompatible.
        Type 'Observable<any>' is not assignable to type 'Observable<any>'. Two different types with this name exist, but they are unrelated.

Since the library is linked the dev dependency is present in the linked lib’s node_modules folder which is causing the issue.

Suggestion

If peer dependencies are present in the top-level app the nested versions of the dependency should be ignored.

Reproduction Steps

  1. cd my-app
  2. npm install
  3. npm link ../my-lib
  4. npm run-script build

Details

-

Platform Info

$ npm --versions
{ npm: '5.6.0',
  ares: '1.10.1-DEV',
  cldr: '32.0',
  http_parser: '2.8.0',
  icu: '60.1',
  modules: '57',
  nghttp2: '1.25.0',
  node: '8.11.1',
  openssl: '1.0.2o',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.19.1',
  v8: '6.2.414.50',
  zlib: '1.2.11' }

$ node -p process.platform
win32


(Markus) #2

Has anyone looked into this already?
This is still a fairly big issue for my workflow.