Topic: Weird error with asynchronous data source

shellxsoftware free asked 2 years ago

Expected behavior Basically i'm getting a weird error when trying to use an asynchronous data source for data tables.

Actual behavior Type 'any[] | null' is not assignable to type 'any[]'. Type 'null' is not assignable to type 'any[]'.ngtsc(2322)

Resources (screenshots, code snippets etc.) See above ^

Arkadiusz Idzikowski staff commented 2 years ago

@shellxsoftware Could you please provide a simple TS code example so we can reproduce that on our end?

shellxsoftware free commented 2 years ago

it's basically just in the screenshot, one line of code.

Arkadiusz Idzikowski staff answered 2 years ago

@shellxsoftware Please try to disable type checking for this input:

[dataSource]="$any(dataSource$ | async)"

You may also need to initialize the dataSource value in ts file:

dataSource$: Observable<any[]> = of([]);

We will check what we can do to resolve this problem on our end.

Edit: This problem was fixed in v1.6.0

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: MDB5 1.3.0
  • Device: --
  • Browser: --
  • OS: --
  • Provided sample code: No
  • Provided link: Yes