refactor(middleware): replace export * with explicit named and type exports#3151
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
084bb12 to
d8e2046
Compare
|
This is somewhat intentional. I think we should have more explicit control on what to export from the package. I would like to change |
a6e8d92 to
398e477
Compare
| export { redux } from './middleware/redux.ts' | ||
| export { | ||
| devtools, | ||
| type DevtoolsOptions, | ||
| type NamedSet, | ||
| } from './middleware/devtools.ts' | ||
| export { subscribeWithSelector } from './middleware/subscribeWithSelector.ts' | ||
| export { combine } from './middleware/combine.ts' | ||
| export { | ||
| persist, | ||
| createJSONStorage, | ||
| type StateStorage, | ||
| type StorageValue, | ||
| type PersistStorage, | ||
| type PersistOptions, | ||
| } from './middleware/persist.ts' |
There was a problem hiding this comment.
This is somewhat intentional. I think we should have more explicit control on what to export from the package. I would like to change
middleware.tsto followshallow.tsstyle. I thought it would be a breaking change, but maybe not. Can you try it please?
I reflected your opinion. How does it look like?
There was a problem hiding this comment.
Sorry for the delay. Yeah, this looks good. This keeps everything as is, right?
There was a problem hiding this comment.
Only the changes mentioned above have been made.
// shallow.d.ts
export { shallow } from 'zustand/vanilla/shallow';
export { useShallow } from 'zustand/react/shallow';
// esm/shallow.d.mts
export { shallow } from 'zustand/vanilla/shallow';
export { useShallow } from 'zustand/react/shallow';It is the same as shallow.
dai-shi
left a comment
There was a problem hiding this comment.
I'll merge this when preparing a new release.
| export { redux } from './middleware/redux.ts' | ||
| export { | ||
| devtools, | ||
| type DevtoolsOptions, | ||
| type NamedSet, | ||
| } from './middleware/devtools.ts' | ||
| export { subscribeWithSelector } from './middleware/subscribeWithSelector.ts' | ||
| export { combine } from './middleware/combine.ts' | ||
| export { | ||
| persist, | ||
| createJSONStorage, | ||
| type StateStorage, | ||
| type StorageValue, | ||
| type PersistStorage, | ||
| type PersistOptions, | ||
| } from './middleware/persist.ts' |
There was a problem hiding this comment.
Sorry for the delay. Yeah, this looks good. This keeps everything as is, right?
Related Bug Reports or Discussions
Fixes #
Summary
middleware.ts*syntax, we still only exportuseShallowinreact/shallow.tsandshallowinvanilla/shallow.tsCheck List
pnpm run fixfor formatting and linting code and docs