Skip to content
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

Rename Op type and export it #972

Closed
overthemike opened this issue Oct 14, 2024 Discussed in #971 · 3 comments · Fixed by #973
Closed

Rename Op type and export it #972

overthemike opened this issue Oct 14, 2024 Discussed in #971 · 3 comments · Fixed by #973

Comments

@overthemike
Copy link
Collaborator

Discussed in #971

Originally posted by teetotum October 14, 2024
The import of type Op is not recognized: Module '"valtio"' has no exported member 'Op'.ts(2305)
What would be the correct import for valtio types?
I'm on valtio 1.13.0

import { subscribe, proxy, type Op } from 'valtio'

// ...
// const state = ...
// ...

subscribe(proxy(state), (ops: Op[]) => {
  // ...
})

Since ops are passed into a callback for the user during a subscribe, it would be helpful to export the type that the user can expect. Might be a good idea to rename it to something that explains what it is a bit better as well.

@dai-shi
Copy link
Member

dai-shi commented Oct 14, 2024

Op is an internal type and not considered a public API. Let me rename it to clarify it.

@overthemike
Copy link
Collaborator Author

https://github.com/pmndrs/valtio/blob/main/src/vanilla.ts#L272 - In that case, should it be passed to the user in the callback?

@dai-shi
Copy link
Member

dai-shi commented Oct 14, 2024

It's used by third-party libraries.

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 a pull request may close this issue.

2 participants