Skip to content

chore: export missing types for createQueryKeyStore (#108)#113

Open
yeinMOON wants to merge 1 commit intolukemorales:mainfrom
yeinMOON:fix/108-export-missing-types
Open

chore: export missing types for createQueryKeyStore (#108)#113
yeinMOON wants to merge 1 commit intolukemorales:mainfrom
yeinMOON:fix/108-export-missing-types

Conversation

@yeinMOON
Copy link

Export missing types for createQueryKeyStore

Closes #108

Description

This PR exports the missing types that are needed to properly type wrapper functions around createQueryKeyStore. Previously, users couldn't access the input and output types of createQueryKeyStore, making it difficult to create properly typed wrapper functions.

Changes

  • Exported QueryKeyStoreSchema type from create-query-key-store.ts
  • Added type exports to index.ts:
    • QueryKeyStore - The return type of createQueryKeyStore
    • QueryKeyStoreSchema - The input type for createQueryKeyStore
    • QueryFactorySchema - The schema type used in query key factories

Usage Example

Users can now properly type wrapper functions:

import { createQueryKeyStore, type QueryKeyStoreSchema } from '@lukemorales/query-key-factory';

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

const result = createQueryKeyStoreWrapper('store', {
  users: {
    all: null,
    detail: (userId: string) => ({
      queryKey: [userId],
      queryFn: () => api.getUser(userId),
    }),
  },
});

// Type inference now works correctly
result.users.detail('1234').queryKey; // ["users", "detail", string]
result.users.all.queryKey; // ["users", "all"]

Testing

  • TypeScript compilation passes
  • No breaking changes to existing APIs
  • Types are properly exported and accessible

@changeset-bot
Copy link

changeset-bot bot commented Jan 24, 2026

🦋 Changeset detected

Latest commit: c22184d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@lukemorales/query-key-factory Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@yeinMOON yeinMOON force-pushed the fix/108-export-missing-types branch from 8dc5fb5 to c22184d Compare January 24, 2026 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typings: Missing type exports

1 participant