-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
fix: export types needed for defining custom stores #7358
Conversation
I wrote a custom store to have a more flexible `derived` store. The function signatures looks like: ```typescript export function derivedWritable<S extends Stores, T>( stores: S, fn: (values: StoresValues<S>, set: (value: T) => void) => Unsubscriber | void, initial_value?: T ): Writable<T> { ... } ``` Both `Stores` and `StoresValues` are not exported in `svelte/store`. I had to copy paste the type definition from this file and duplicate code. Unless I'm using TypeScript wrong (I'm still quite new to it), I think these types plus few others should be exported.
Related, I want to use the types I'm using this workaround for the spring module to avoid copy/pasting, but this strategy does not work for all of the types exported in this PR: type SpringOpts = Exclude<Parameters<typeof spring>[1], undefined>;
type SpringUpdateOpts = Exclude<Parameters<ReturnType<typeof spring>['update']>[1], undefined>; My apologies if this is the wrong place for this. In my case it's a trivial issue. |
👋 Any updates? The PR is ready, all tests pass, is there anything else left? Thanks! |
@baseballyama @bluwy: would it make sense to update this PR to export also the types mentioned by @ryanatkn? Wondering if there are more types that should be exported 🤔. PS: sorry for the direct mention, just wanted to move this forward if possible ❤️ |
Just came to make this same PR. I keep having to manually add export directives each time I update the package. |
AFAIK @Conduitry had reservations of exposing the |
Not sure why you say it's a lost cause. You have devs that are asking for these types to be exported. That's a clear need. I'm not sure why this is not part of the discussion. |
Closing this PR because in the meantime I moved to react 😂 |
I wrote a custom store to have a more flexible
derived
store. The function signatures looks like:Both
Stores
andStoresValues
are not exported insvelte/store
. I had to copy paste the type definition from this file and duplicate code. Unless I'm using TypeScript wrong (I'm still quite new to it), I think these types plus few others should be exported.Before submitting the PR, please make sure you do the following
[feat]
,[fix]
,[chore]
, or[docs]
.Tests
npm test
and lint the project withnpm run lint