node_modules/rxjs-compat/operator/shareReplay.d.ts(2,10) 中的错误:

Posted

技术标签:

【中文标题】node_modules/rxjs-compat/operator/shareReplay.d.ts(2,10) 中的错误:【英文标题】:ERROR in node_modules/rxjs-compat/operator/shareReplay.d.ts(2,10): 【发布时间】:2019-12-07 15:36:23 【问题描述】:

我在我的项目中使用了角度材质微调器,但是它显示了这个

错误 TS2305:模块 '"D:/ControlCenter/ofservices/node_modules/rxjs/internal-compatibility/index"' 没有导出的成员“ShareReplayConfig”。

我收到此错误:

错误 TS2305:模块 '"D:/ControlCenter/ofservices/node_modules/rxjs/internal-compatibility/index"' 没有导出的成员“ShareReplayConfig” `

谁能帮帮我???

spinner.service.ts 文件

import  Injectable  from '@angular/core';
import  Observable, Subject  from 'rxjs/Rx';
export interface ISpinnerState 
  show: boolean


@Injectable()
export class SpinnerService 
  private _spinnerSubject = new Subject();

spinnerState = <Observable<ISpinnerState>>this._spinnerSubject.asObservable();
  show() 
    this._spinnerSubject.next(<ISpinnerState> show: true );
  
  hide() 
    this._spinnerSubject.next(<ISpinnerState> show: false );
  

spinner.component.ts

import Component, OnDestroy, OnInit from '@angular/core';
import  Subscription  from 'rxjs/Rx';
import   ISpinnerState, SpinnerService  from './services/spinner.service';
@Component(
  selector: 'loading-spinner',
  template: `
  <div *ngIf="visible"
  class="spinner">
</div>
  `,
  styles: [`.spinner position: absolute;left: 46%;top: 12%;background-color:black;width:50px;height:50px`]
)

export class SpinnerComponent implements OnDestroy, OnInit 
  visible = false;

  private _spinnerStateChanged: Subscription;

  constructor(private _spinnerService: SpinnerService)  

  ngOnInit() 
    this._spinnerStateChanged = this._spinnerService.spinnerState
      .subscribe((state: ISpinnerState) => this.visible = state.show);
  
  ngOnDestroy() 
    this._spinnerStateChanged.unsubscribe();
  

【问题讨论】:

【参考方案1】:

试试这个版本,看看它是否适合你

"rxjs": "6.3.3", 
"rxjs-compat": "6.3.3",

【讨论】:

以上是关于node_modules/rxjs-compat/operator/shareReplay.d.ts(2,10) 中的错误:的主要内容,如果未能解决你的问题,请参考以下文章

启动我的项目时出错(运行 ng serve 后)

ec2 构建框中的 Ng 构建问题,但在本地没有