Skip to content

Typings: Missing type exports #108

@Sylphide

Description

@Sylphide

Would it be possible to export some of the types used in the library?

I am trying to implement a wrapper function of createQueryKeyStore but I can't find a way to get the typings right.

A simple reproduction example is:

function createQueryKeyStoreWrapper<T>(name: string, storeDefinitions: T) {
  return createQueryKeyStore(name, storeDefinitions); //Argument of type 'T' is not assignable to parameter of type '{ [x: string]: FactoryProperty | DynamicKey; }'
}

I tried redefining QueryFactorySchema on my end but then

function createQueryKeyStoreWrapper<T extends QueryFactorySchema>(name: string, storeDefinitions: T) {
  return createQueryKeyStore(name, storeDefinitions); 
}

const result = createQueryKeyStoreWrapper('store', {
  byId: (id: number) => [id]
})
result.byId // byId is of type never

I think it would be easier if types like createQueryKeyStore inputs and outputs were to be exported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions