ReactiveX/rxjs

Property 'currentObservers' is missing in type rxjs

baronkoko opened this issue · 1 comments

Describe the bug

A typescript error occurs when using the Subject as a type. Can someone help with this, please?

Argument of type '(subscription: Subject<void>) => void' is not assignable to parameter of type '(value: { closed: boolean; observers: { next: (value: void) => void; error: (err: any) => void; complete: () => void; }[]; isStopped: boolean; hasError: boolean; thrownError: any; lift: <R>(operator: Operator<void, R>) => Observable<...>; ... 11 more ...; toPromise: { ...; }; }, index: number, array: { ...; }[]) => ...'.
  Types of parameters 'subscription' and 'value' are incompatible.
    Property 'currentObservers' is missing in type '{ closed: boolean; observers: { next: (value: void) => void; error: (err: any) => void; complete: () => void; }[]; isStopped: boolean; hasError: boolean; thrownError: any; lift: <R>(operator: Operator<void, R>) => Observable<...>; ... 11 more ...; toPromise: { ...; }; }' but required in type 'Subject<void>'.

image

Expected behavior

When using the Subject as a type, typescript errors should not occur

Reproduction code

No response

Reproduction URL

https://stackblitz.com/edit/nuxt-starter-hvcakf?file=app.vue

Version

7.8.0

Environment

No response

Additional context

No response

https://stackblitz.com/edit/rxjs-tpwmt9?file=index.ts

Using rxjs only works fine. This seems related with this context in nuxt with its defining components for inner context values, which rxjs cannot control over.

If you still think this is rxjs side issue, please create a repro without nuxt involved.