You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
here, this.__linkServ.links is type of Observable and this.__userServ.getUserInfo() is type of ReplaySubject, but folow code get error. combineLatest([this.__linkServ.links, this.__userServ.getUserInfo()]) .pipe(takeUntil(this.__destroy$)) .subscribe(([links, userInfo]) => { const link = links?.tms_predefinedTag_common || ''; const hasAuth = !userInfo?.roles?.includes('op_gated_tms'); const predefinedTag = this.operators?.items?.[0]!; predefinedTag.hide = !(link && hasAuth); predefinedTag.link.href = link; });
if i specify the types manully like: combineLatest([this.__linkServ.links, this.__userServ.getUserInfo()] as [Observable<any>,Observable<any>]) .pipe(takeUntil(this.__destroy$)) .subscribe(([links, userInfo]) => { const link = links?.tms_predefinedTag_common || ''; const hasAuth = !userInfo?.roles?.includes('op_gated_tms'); const predefinedTag = this.operators?.items?.[0]!; predefinedTag.hide = !(link && hasAuth); predefinedTag.link.href = link; });
it is ok.
Another thing is, the former code combineLatest refers to
but the later refers to
Expected behavior
no error
Reproduction code
No response
Reproduction URL
No response
Version
7.4.0
Environment
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
Can you please provide a playground with something that can be reproduced? Codesandbox or Stackblitz.
I tried a simple example
constlinks: Observable<unknown>=nullasany;constuserInfo: ReplaySubject<unknown>=nullasany;combineLatest([links,userInfo]).subscribe(([links,userInfo])=>{// Works correctly})
My env is rxjs@7.5.7
If you manage to create a sandbox for it, it will be simpler to find out what's the issue
Describe the bug
here, this.__linkServ.links is type of Observable and this.__userServ.getUserInfo() is type of ReplaySubject, but folow code get error.
combineLatest([this.__linkServ.links, this.__userServ.getUserInfo()]) .pipe(takeUntil(this.__destroy$)) .subscribe(([links, userInfo]) => { const link = links?.tms_predefinedTag_common || ''; const hasAuth = !userInfo?.roles?.includes('op_gated_tms'); const predefinedTag = this.operators?.items?.[0]!; predefinedTag.hide = !(link && hasAuth); predefinedTag.link.href = link; });
if i specify the types manully like:
combineLatest([this.__linkServ.links, this.__userServ.getUserInfo()] as [Observable<any>,Observable<any>]) .pipe(takeUntil(this.__destroy$)) .subscribe(([links, userInfo]) => { const link = links?.tms_predefinedTag_common || ''; const hasAuth = !userInfo?.roles?.includes('op_gated_tms'); const predefinedTag = this.operators?.items?.[0]!; predefinedTag.hide = !(link && hasAuth); predefinedTag.link.href = link; });
it is ok.
Another thing is, the former code combineLatest refers to
but the later refers to
Expected behavior
no error
Reproduction code
No response
Reproduction URL
No response
Version
7.4.0
Environment
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: