Skip to content
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

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

Closed
vincent-cm opened this issue May 31, 2018 · 15 comments · Fixed by thomasvht/centauraEventApp#4

Comments

@vincent-cm
Copy link

vincent-cm commented May 31, 2018

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

@cartant
Copy link
Collaborator

cartant commented May 31, 2018

Dupe of #3697?

@kwonoj
Copy link
Member

kwonoj commented May 31, 2018

Looks likely by reading error message.

@vincent-cm
Copy link
Author

vincent-cm commented Jun 1, 2018

@cartant
Copy link
Collaborator

cartant commented Jun 1, 2018

@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.

@ulfryk
Copy link

ulfryk commented Jun 7, 2018

#3773 merged, is there release ETA ?

@andreimcristof
Copy link

got this error. how to workaround until release please?

@vincent-cm
Copy link
Author

vincent-cm commented Jun 8, 2018

@andreimcristof fallback your types/node version

@andreimcristof
Copy link

@vincent-cm thanks, it worked. cheers

@cristifilip
Copy link

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

@morrisonbrett
Copy link

Confirmed. 6.2.1 working for me.

@TdoubleG
Copy link

TdoubleG commented Jul 2, 2018

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.

@cartant
Copy link
Collaborator

cartant commented Jul 2, 2018

@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.

@TdoubleG
Copy link

TdoubleG commented Jul 2, 2018

this is the output of npm list rxjs:

@angular-devkit/build-angular@0.6.8
│ ├─┬ @angular-devkit/architect@0.6.8
│ │ └── rxjs@6.2.1  deduped
│ └── rxjs@6.2.1  deduped
├─┬ @angular-devkit/core@0.6.8
│ └── rxjs@6.2.1  deduped
├─┬ @angular/cli@6.0.8
│ ├─┬ @angular-devkit/schematics@0.6.8
│ │ └── rxjs@6.2.1  deduped
│ ├─┬ @schematics/update@0.6.8
│ │ └── rxjs@6.2.1  deduped
│ └── rxjs@6.2.1  deduped
└── rxjs@6.2.1

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

@cartant
Copy link
Collaborator

cartant commented Jul 2, 2018

@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.

@TdoubleG
Copy link

TdoubleG commented Jul 2, 2018

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

@lock lock bot locked as resolved and limited conversation to collaborators Aug 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants