Definitelytyped: @types/node observable declaration conflicts with rxjs

Created on 1 Jun 2018  路  20Comments  路  Source: DefinitelyTyped/DefinitelyTyped

I'm seeing this error since @types/node 10.3.0 was published yesterday:

node_modules/@types/node/index.d.ts(167,14): error TS2687: All declarations of 'observable' must have identical modifiers.node_modules/rxjs/internal/symbol/observable.d.ts(4,9): error TS2687: All declarations of 'observable' must have identical modifiers

See also angular/angular#24245 and stackoverflow.com/q/50639530.

Most helpful comment

If anyone needs an immediate fix, downgrading @types/node to 10.1.2 should work (this was the last release before updating observable to readonly).

All 20 comments

See also ReactiveX/rxjs#3697 - seems like it's actually rxjs that should be updated?

Similar issue, except my conflict is with @types/zen-observable.

node_modules/@types/node/index.d.ts:167:14 - error TS2687: All declarations of 'observable' must have identical modifiers.

167     readonly observable: symbol;
                 ~~~~~~~~~~


node_modules/@types/zen-observable/index.d.ts:8:9 - error TS2687: All declarations of 'observable' must have identical modifiers.

8         observable: symbol;
          ~~~~~~~~~~

@mirkonasato Looks like you're correct, rxjs just hasn't updated yet, @types/node was updated 7 days ago (https://github.com/DefinitelyTyped/DefinitelyTyped/commit/e22898d5b679ae1fe06d75344b4440a839835455) but the corresponding update with rxjs (https://github.com/ReactiveX/rxjs/commit/e1c203f36b023bd6a0f94531761e077958be7c9f) just authored 4 hours ago.

See https://github.com/ReactiveX/rxjs/issues/3697#issuecomment-390539396

If anyone needs an immediate fix, downgrading @types/node to 10.1.2 should work (this was the last release before updating observable to readonly).

Thanks @cameronk

thank you @cameronk the workaround worked.

I have the same issue when updated to rxjs 6.2.1

@alonstar As do I.

ERROR in node_modules/@types/zen-observable/index.d.ts(8,9): error TS2687: All declarations of 'observable' must have identical modifiers.

rxjs@^6.2.1, rxjs-compat@^6.2.1, @types/node^10.3.3, node itself at 10.4.1.

I guess @types/zen-observable must be updated, too

@Ben305 - #26547 and #26239 are tracking that

I'm using aws-amplify and rxjs on a lambda, amplify installs @types/zen-observable.

So I'm doing the following hack while they push the zen-observable fix

"hack": "pushd node_modules/@types/zen-observable && sed -i 's/observable: symbol/readonly observable: symbol/' index.d.ts && popd"

I use that on my CI/CD after npm install

On OSX it's sed -i '' 's/observable: symbol/readonly observable: symbol/' index.d.ts

@amacleay thanks for linking the issues related to @types/zen-observable. I was looking for that.

The problem is still present with latest versions:

    "rxjs": "6.2.1",
    "@types/node": "10.5.1"
ERROR in ../node_modules/rxjs/internal/symbol/observable.d.ts(4,9): error TS2687: All declarations of 'observable' must have identical modifiers.

node_modules/@types/node/index.d.ts(169,14): error TS2687: All declarations of 'observable' must have identical modifiers.

Seems ok with rxjs 6.2.2, not getting the error anymore.

Closing since it's been fixed by ReactiveX/rxjs#3697.

I still have the same errors. my packages:

and with Angular 6.1, Node.js v10.7.0

How do I fix this errors?

ERROR in node_modules/@types/node/index.d.ts(169,14): error TS2687: All declarations of 'observable' must have identical modifiers.
node_modules/@types/zen-observable/index.d.ts(8,9): error TS2687: All declarations of 'observable' must have identical modifiers.

@alonstar
What I did:

  • I installed the working versions: rxjs 6.2.0 and @types/node 10.1.4
  • Push the working project and jenkins started to build
  • It failed at the test pipeline with the error message, that I'm using wrong import paths e.g. rxjs/add/observable/of
  • Fixing all tests with correct imports, e.g. import { of } from "rxjs";
  • Updates to rxjs 6.2.1 and @types/node 10.5.2
  • Pushed again and the build worked

So have a look, if you have still wrong imports. Look also for *.spec.ts files if there are any wrong imports

@adappter I have a working version: rxjs 6.2.0 & @types/node 10.1.4 typescript 2.7.2 (Angular 6.0.4)
When I upgraded angular 6.0.4 to 6.1.0, it is also upgraded rxjs to 6.2.2.

And after upgrading, rebuild project, I got this error. ( rxjs 6.2.2 , @types/node 10.1.4, typescripts 2.9.2 )

> ng serve

** Angular Live Development Server is listening on localhost:4300, open your browser on http://localhost:4300/ **

Date: 2018-07-30T09:24:38.267Z
Hash: 018c951f3599b23ff1cc
Time: 28291ms
chunk {main} main.js, main.js.map (main) 1.98 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 709 bytes [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 5.22 kB [entry] [rendered]
chunk {scripts} scripts.js, scripts.js.map (scripts) 26.6 kB  [rendered]
chunk {styles} styles.js, styles.js.map (styles) 2.26 MB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 325 kB [initial] [rendered]

ERROR in node_modules/@types/zen-observable/index.d.ts(8,9): error TS2687: All declarations of 'observable' must have identical modifiers

PS: I have fix imports when upgrading Angular to 6.0.4 before.

then the problem is zen-observable. did you look for the index.d.ts of zen-observable if it looks the same as rxjs/index.d.ts

@adappter Thank you, I found apollo client needs upgrade, too.

pushd node_modules/@types/zen-observable && sed -i 's/observable: symbol/readonly observable: symbol/' index.d.ts && popd

You just fixed my issue, thanks :)

Was this page helpful?
0 / 5 - 0 ratings