Rxjs: Build error when using rxjs-compat: All declarations of 'observable' must have identical modifiers.

Created on 1 Jun 2018  ยท  15Comments  ยท  Source: ReactiveX/rxjs

Bug Report

Current Behavior
A clear and concise description of the behavior.
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(167,14): error TS2687: All declarations of 'observable' must have identical modifiers.

Reproduction
After installing rxjs 6.2.0 and rxjs-compat 6.2.0, navigate to
'/node_modules/rxjs/internal/symbol/observable.d.ts'
and
'./node_modules/\@types/node/index.d.ts'

The IDE will indicate the error line
readonly observable: symbol;

[ts] All declarations of 'observable' must have identical modifiers.
(property) SymbolConstructor.observable: symbol

Expected behavior
The source code has error when using IDE to inspect.

The error should not appear.
Environment

  • Runtime: [e.g. Node v10.2.1, VSCode 1.23.1
  • RxJS version: 6.2.0

Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.
https://imgur.com/a/eMdeN6k

needs info

Most helpful comment

this has been fixed in 6.2.1 https://www.npmjs.com/package/rxjs/v/6.2.1

All 15 comments

Dupe of #3697?

Looks likely by reading error message.

@types/node uses the readonly modifier:

interface SymbolConstructor {
    readonly observable: symbol;
    readonly iterator: symbol;
    readonly asyncIterator: symbol;
}

as does symbol-observable:

declare global {
  export interface SymbolConstructor {
    readonly observable: symbol;
  }
}

The declaration in master does not. but once #3773 is merged, all of the declarations should be compatible.

3773 merged, is there release ETA ?

got this error. how to workaround until release please?

@andreimcristof fallback your types/node version

@vincent-cm thanks, it worked. cheers

this has been fixed in 6.2.1 https://www.npmjs.com/package/rxjs/v/6.2.1

Confirmed. 6.2.1 working for me.

The problem is still present with latest versions:

    "rxjs": "6.2.1",
    "@types/node": "10.3.6"
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.

@adappter The declaration is readonly observable: symbol; in @types/node version 10.5.1 and is the same in rxjs 6.2.1.

You might want to update to the latest @types/node declarations and might also want to ensure that you have only one installation of rxjs in your node_modules - to do so, run npm list rxjs.

this is the output of npm list rxjs:

@angular-devkit/[email protected]
โ”‚ โ”œโ”€โ”ฌ @angular-devkit/[email protected]
โ”‚ โ”‚ โ””โ”€โ”€ [email protected]  deduped
โ”‚ โ””โ”€โ”€ [email protected]  deduped
โ”œโ”€โ”ฌ @angular-devkit/[email protected]
โ”‚ โ””โ”€โ”€ [email protected]  deduped
โ”œโ”€โ”ฌ @angular/[email protected]
โ”‚ โ”œโ”€โ”ฌ @angular-devkit/[email protected]
โ”‚ โ”‚ โ””โ”€โ”€ [email protected]  deduped
โ”‚ โ”œโ”€โ”ฌ @schematics/[email protected]
โ”‚ โ”‚ โ””โ”€โ”€ [email protected]  deduped
โ”‚ โ””โ”€โ”€ [email protected]  deduped
โ””โ”€โ”€ [email protected]

I installed the latest @types/nodes 10.5.1. I can also see the same declarations in both files. But I still get the error. Also after reinstalled node modules

@adappter You should be able to verify, yourself, that the @types/node and rxjs declarations for observable symbol match. If they do, then your issue differs from this one. Perhaps there is another declaration of observable symbol somewhere in your code base?

In any case, if the two declarations are the same, you should open another issue instead of commenting on this issue - which is closed. As a general rule, it's better to create a new issue rather than comment on one that's closed. Just reference the closed issue from the newly opened one, if you suspect they are related.

Alright I'll have a look at will open a new issue if necessary

Was this page helpful?
0 / 5 - 0 ratings

Related issues

benlesh picture benlesh  ยท  3Comments

jakovljevic-mladen picture jakovljevic-mladen  ยท  3Comments

cartant picture cartant  ยท  3Comments

Agraphie picture Agraphie  ยท  3Comments

Zzzen picture Zzzen  ยท  3Comments