Skip to content

ts error when using combine with primitive values  #784

@vitalik-l

Description

@vitalik-l

Example from the docs doesn't work with typescript (https://effector.dev/docs/api/effector/combine/#combine-with-primitives-and-objects)

const $a = createStore('a')
const b = 2
const c = [false]
const d = { value: 1 }

const $resultUsingComa = combine($a, b, c, d)

TS error:

No overload matches this call.
  Overload 1 of 18, '(a: Store<string>, b: Store<unknown>, c: Store<unknown>, fn: (a: string, b: unknown, c: unknown) => unknown): Store<unknown>', gave the following error.
    Argument of type 'number' is not assignable to parameter of type 'Store<unknown>'.
  Overload 2 of 18, '(stores_0?: Store<any> | undefined, ...stores_1: Store<any>[]): Store<[(Store<any> | undefined)?, ...any[]]>', gave the following error.
    Argument of type 'number' is not assignable to parameter of type 'Store<any>'.

Relevant documentation

https://effector.dev/docs/api/effector/combine/#combine-with-primitives-and-objects

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtypingsTypescript public type definitions issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions