Rxjs: imports use of type FromEventTarget<T>

Created on 17 Jul 2020  路  1Comment  路  Source: ReactiveX/rxjs

Bug Report

Current Behavior
Not sure this is an issue or documentation needed but we would like to use the type from FromEventTarget.

We have a method in a mixin for out form controls in an angular lib as follows:

  /**
   * Registers a subscription for touch events that will be propagated
   * @param target  The element to listen for events
   * @param event  The event to listen to
   */
  subscribeTouch<T>(target: FromEventTarget<T>, event: string): void {
    this.touchedListener = fromEvent(target, event).subscribe((evt: any) => {
      this.onTouch(evt);
    });
  }

However when consuming the lib in an app we are spammed with some warnings:

Warning: Entry point '@bla/ngx-bla-lib' contains deep imports into '..../node_modules/rxjs/internal/observable/fromEvent'. This is probably not a problem, but may cause the compilation of entry points to be out of order.

Just wondering how we could import the type and avoid the spamming from the angular cli and thus sleep better at night.

Expected behavior
an entry point to import the type that isnt a deep import ?
explanation on how to avoid this.

TS types

Most helpful comment

I think we could add param types into top-level exports.

>All comments

I think we could add param types into top-level exports.

Was this page helpful?
0 / 5 - 0 ratings