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) https://i.gyazo.com/a0ed3a32c9a54fd57dbce3c1c6c91c63.png https://i.gyazo.com/f6348c1cfe7fcb4a5a4d736bfcd7a137.png
Resources (screenshots, code snippets etc.) See above ^
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
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- ForumUser: Free
- Premium support: No
- Technology: MDB Angular
- MDB Version: MDB5 1.3.0
- Device: --
- Browser: --
- OS: --
- Provided sample code: No
- Provided link: Yes
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.