首页 > 解决方案 > Expected 0 type arguments, but got 1.ts(2558)

问题描述

I'm creating a new angular service for components communication. but once I create my new Subject , I get this error : Expected 0 type arguments, but got 1.ts(2558). I'm working with Angular 7. this is My service :

import { Injectable  } from '@angular/core';
import { Subject } from '../../../types/rxjs';

@Injectable({
  providedIn: 'root'
})
export class InteractionService {

  private sprintData = new Subject<any[]>();
  constructor() { }
}

标签: typescriptangular7

解决方案


Only thing I can think of is your import statement. I'd change that to:

import { Subject } from 'rxjs';

I suspect that your current import is from internals.


推荐阅读