Skip to content

fix: missing export of imported Invalidator type #12311

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/svelte/src/store/public.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ interface Writable<T> extends Readable<T> {
update(this: void, updater: Updater<T>): void;
}

export { Readable, StartStopNotifier, Subscriber, Unsubscriber, Updater, Writable };
export { Invalidator, Readable, StartStopNotifier, Subscriber, Unsubscriber, Updater, Writable };

export * from './index.js';
20 changes: 19 additions & 1 deletion packages/svelte/tests/store/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import { describe, it, assert } from 'vitest';
import { readable, writable, derived, get, readonly, type Readable } from 'svelte/store';
import {
readable,
writable,
derived,
get,
readonly,
type Readable,
type Invalidator
} from 'svelte/store';

describe('writable', () => {
it('creates a writable store', () => {
Expand Down Expand Up @@ -574,3 +582,13 @@ describe('readonly', () => {
assert.throws(() => readableStore.set(3));
});
});

describe('type Invalidator', () => {
it('check it is exported from the store', () => {
// dummy test importing Invalidator from store
// to check if it is exported
// it will fail with tsc if not exported
const invalidator: Invalidator<number> = () => {};
assert.equal(typeof invalidator, 'function');
});
});
2 changes: 1 addition & 1 deletion packages/svelte/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2298,7 +2298,7 @@ declare module 'svelte/store' {
* */
export function get<T>(store: Readable<T>): T;

export { Subscriber, Unsubscriber, Updater, StartStopNotifier, Readable, Writable };
export { Subscriber, Unsubscriber, Updater, StartStopNotifier, Readable, Writable, Invalidator };
}

declare module 'svelte/transition' {
Expand Down