Skip to content

Commit 1a02fc1

Browse files
committed
fix: missing export of imported Invalidator type
fixes #12276 Signed-off-by: Florent Benoit <fbenoit@redhat.com>
1 parent e42bb61 commit 1a02fc1

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

packages/svelte/src/store/public.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ interface Writable<T> extends Readable<T> {
4848
update(this: void, updater: Updater<T>): void;
4949
}
5050

51-
export { Readable, StartStopNotifier, Subscriber, Unsubscriber, Updater, Writable };
51+
export { Invalidator, Readable, StartStopNotifier, Subscriber, Unsubscriber, Updater, Writable };
5252

5353
export * from './index.js';

packages/svelte/tests/store/test.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
import { describe, it, assert } from 'vitest';
2-
import { readable, writable, derived, get, readonly, type Readable } from 'svelte/store';
2+
import {
3+
readable,
4+
writable,
5+
derived,
6+
get,
7+
readonly,
8+
type Readable,
9+
type Invalidator
10+
} from 'svelte/store';
311

412
describe('writable', () => {
513
it('creates a writable store', () => {
@@ -574,3 +582,13 @@ describe('readonly', () => {
574582
assert.throws(() => readableStore.set(3));
575583
});
576584
});
585+
586+
describe('type Invalidator', () => {
587+
it('check it is exported from the store', () => {
588+
// dummy test importing Invalidator from store
589+
// to check if it is exported
590+
// it will fail with tsc if not exported
591+
const invalidator: Invalidator<number> = () => {};
592+
assert.equal(typeof invalidator, 'function');
593+
});
594+
});

packages/svelte/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2298,7 +2298,7 @@ declare module 'svelte/store' {
22982298
* */
22992299
export function get<T>(store: Readable<T>): T;
23002300

2301-
export { Subscriber, Unsubscriber, Updater, StartStopNotifier, Readable, Writable };
2301+
export { Subscriber, Unsubscriber, Updater, StartStopNotifier, Readable, Writable, Invalidator };
23022302
}
23032303

23042304
declare module 'svelte/transition' {

0 commit comments

Comments
 (0)