-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
refactor(types): expose types for react-query/es/*
#1093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
By using `typesVersions` instead of `types` pointing to a single `index` declaration file, we enable consumers of `react-query` to also import directly from nested files.
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/tannerlinsley/react-query/2op9qrg0v |
Tested this change in a project but it's seems to break the regular |
@boschni Thank you for looking into this, and sorry, that I broke it. 😓 I've also verified that all these imports resolve correctly: import { useInfiniteQuery, useQuery } from 'react-query';
import type { Query } from 'react-query/es/core';
import type { QueryCache } from 'react-query/es/core/queryCache';
import type { ReactQueryConfig } from 'react-query/es/core/types';
import type { HydrateProps } from 'react-query/hydration'; |
No problem! I made some changes in the V3 branch to create multiple entry points: #1079. With these changes it should be possible to do the following, while supporting multiple export formats and types: import { Query } from 'react-query/core'
import { useQuery } from 'react-query/react'
import { HydrateProps } from 'react-query/hydration' |
typesVersions
over types
react-query/es/*
Are you implying that you would rather hold back with this until v3 (#772) lands and close this PR or do you think that we could still ship this improvement for v2? 😊 |
Yes I would rather hold this one off in favor of the v3 release, I hope we can push out a pre-release this week |
Awesome! Looking forward to that. Thank you. |
By using
typesVersions
instead oftypes
pointing to a singleindex
declaration file, we enable consumers ofreact-query
to also import directly from nested files, likereact-query/core
. These files are de-facto importable, but TypeScript does not "see" them currently.I understand that in regular React day to day usage, this is irrelevant (or potentially even undesirable), but I am currently working on building a
react-query
clone for Ember.js and would love to use the rock-solidreact-query/core
as a foundation for this.For
react-query
v3 I'd like to suggest splitting out thecore
lib into a standalone package to make code-sharing easier. It could still reside in this repo by switching to a yarn/lerna monorepo.Thank you for considering! 😊