Page 1 of 1

[ANGULAR] Invalid type of `store` in TypeScript.

Posted: Tue Sep 14, 2021 7:33 am
by striker

I need to type (<Store><any>this.grid.store).add ...


Re: [ANGULAR] Invalid type of `store` in TypeScript.

Posted: Tue Sep 14, 2021 9:27 am
by sergey.maltsev

Hi!

grid.store might have few types Store|object|Partial<StoreConfig>
To use Store please update code to the following

(grid.store as Store).add(args.tasks);

or

 const store = grid.store as Store;
 store.add(args.tasks);

Re: [ANGULAR] Invalid type of `store` in TypeScript.

Posted: Fri Sep 17, 2021 2:53 pm
by striker

This is not same issue like here?
viewtopic.php?f=44&t=18638


Re: [ANGULAR] Invalid type of `store` in TypeScript.

Posted: Fri Sep 17, 2021 3:07 pm
by johan.isaksson

It is the same issue. We have made progress on this in our documentation, which now specifies that it accepts multiple options but always outputs a Store.

But we do not yet have a way of representing it in TypeScript. Unfortunately doing so requires TypeScript 4.3, which is still pretty "new" (https://devblogs.microsoft.com/typescript/announcing-typescript-4-3/#separate-write-types).

Ticket to track (repurposed from the thread linked to above): https://github.com/bryntum/support/issues/3360


Re: [ANGULAR] Invalid type of `store` in TypeScript.

Posted: Fri Sep 17, 2021 3:16 pm
by striker

I understand. Thanks for reply!