Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Collection typeError if passing it into useAgile #76

@bennobuilder

Description

@bennobuilder

🐛 Bug report

🤖 Current Behavior

If you pass a Collection, thats value is not from type DefaultItem into useAgile it complains, that
Collection<DefaultItem> is not Collection<YourCustomInterface>

grafik

Issue is:

TS2769: No overload matches this call.   Overload 1 of 2, '(deps: [] | (Observer<any> | State<any> | Collection<DefaultItem> | undefined)[], key?: string | number | undefined, agileInstance?: Agile | undefined): never[]', gave the following error.     Argument of type 'Collection<collectionValueInterface>' is not assignable to parameter of type '[] | (Observer<any> | State<any> | Collection<DefaultItem> | undefined)[]'.       Type 'Collection<collectionValueInterface>' is missing the following properties from type '(Observer<any> | State<any> | Collection<DefaultItem> | undefined)[]': length, pop, push, concat, and 28 more.   Overload 2 of 2, '(dep: Observer<any> | State<any> | Collection<DefaultItem> | undefined, key?: string | number | undefined, agileInstance?: Agile | undefined): any', gave the following error.     Argument of type 'Collection<collectionValueInterface>' is not assignable to parameter of type 'Observer<any> | State<any> | Collection<DefaultItem> | undefined'.       Type 'Collection<collectionValueInterface>' is not assignable to type 'Collection<DefaultItem>'.         Types of property 'data' are incompatible.           Type '{ [key: string]: Item<collectionValueInterface>; }' is not assignable to type '{ [key: string]: Item<DefaultItem>; }'.             Index signatures are incompatible.               Type 'Item<collectionValueInterface>' is not assignable to type 'Item<DefaultItem>'.                 The types of 'observer.state().computeMethod' are incompatible between these types.                   Type 'ComputeMethod<collectionValueInterface> | undefined' is not assignable to type 'ComputeMethod<DefaultItem> | undefined'.                     Type 'ComputeMethod<collectionValueInterface>' is not assignable to type 'ComputeMethod<DefaultItem>'.                       Types of parameters 'value' and 'value' are incompatible.                         Type 'DefaultItem' is not assignable to type 'collectionValueInterface'.

🎯 Expected behavior

It should be possible to pass a Collection into useAgile without any typeerror

📄 Reproducible example

See example

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions