-
Notifications
You must be signed in to change notification settings - Fork 3k
BehaviorSubject private _value property typings issue #2156
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
Comments
Note: I've been struggling with this for the last few days, trying to find why it's happening. Issue filing here is a last resort, but I'm pretty sure there's something odd going on in rxjs OR typescript causing this. |
I'm suspecting there may be duplicated packages with different version (i.e, rc.xx, rc.4) between dependencies, or either there's linked package (#1744). If you can, I'd like to suggest to start from wipe out all |
I've just tried that:
as well as the same using rxjs is tightly locked to rc.4, as well (no semantic version range). I double checked all the upstream packages are compiled against rc.4 too with a strong version lock (packages A and B). Strange. I'll go back and double check everything again. |
Just in case, please try with |
Okay, done. Finally found the culprit. One random package one of my upstream deps of I really wish rxjs did not emit _value in the typings. I understand why TypeScript emits private fields, but this seems incorrect somehow. Could it instead be If there's no way to fix this awkward problem, feel free to close. I've fixed my issue, but it'd be great if we could figure out some kind of general fix. |
: Unfortunately I don't think we have those level of control to emit specifics. If you refer actual code ( Line 11 in f51b8f9
constructor(private _value: T) have generic type only, but compiler does some magic inside to create internals.
There are continuous effort to improve type definitions over though to resolve inconveniences regarding type definitions. Let me close this issue for now as issue itself is resolved. |
Thanks for your help @kwonoj |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
RxJS version:
5.0.0-rc.4
Code to reproduce:
I will make a code reproduction repo... At the moment it's a bit challenging to do so due to the nature of the bug (multiple packages compiled with emitted definitions).
Multiple packages reference rxjs 5.0.0-rc.4. Package A declares a enum
WindowState
and an interfaceIWindow
which has a fieldstate
that is aBehaviorSubject<WindowState>
. Package B implementsIWindow
properly by referencing package A. Package C references both packages A and B, and experiences the below error when trying to use the implementation ofIWindow
from package B.The
_value
field on BehaviorSubject is private anyway and doesn't have any type associated with it (not evenT
).Expected behavior:
The type error on _value should not be happening.
Actual behavior:
Additional information:
I started noticing this in the upgrade from rc.3 to rc.4. Something changed with _value in this time.
This happens both with using npm install and yarn install. The difference of course being that yarn is very aggressive about flattening the tree, so every package will end up using the same version of rxjs.
Packages
A
andB
are both compiled to JavaScript with emitted TypeScript definitions on TypeScript version 2.1.1.The text was updated successfully, but these errors were encountered: