Skip to content

Commit 4da4898

Browse files
committed
in fact you know what, this whole thing is overkill. get rid of it
1 parent 734c1a8 commit 4da4898

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

packages/svelte/src/store/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @import { Readable, StartStopNotifier, Subscriber, Unsubscriber, Updater, Writable } from './public' */
2-
/** @import { Invalidator, Stores, StoresValues, SubscribeInvalidateTuple } from './private' */
2+
/** @import { Stores, SubscribeInvalidateTuple } from './private' */
33
import { noop, run_all } from '../internal/shared/utils.js';
44
import { safe_not_equal } from '../internal/client/reactivity/equality.js';
55
import { subscribe_to_store } from './utils.js';
@@ -74,7 +74,7 @@ export function writable(value, start = noop) {
7474

7575
/**
7676
* @param {Subscriber<T>} run
77-
* @param {Invalidator} [invalidate]
77+
* @param {() => void} [invalidate]
7878
* @returns {Unsubscriber}
7979
*/
8080
function subscribe(run, invalidate = noop) {
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { Readable, Subscriber } from './public.js';
22

3-
/** Cleanup logic callback. */
4-
type Invalidator = () => void;
5-
63
/** Pair of subscriber and invalidator. */
7-
type SubscribeInvalidateTuple<T> = [Subscriber<T>, Invalidator];
4+
type SubscribeInvalidateTuple<T> = [Subscriber<T>, () => void];
85

96
/** One or more `Readable`s. */
107
type Stores = Readable<any> | [Readable<any>, ...Array<Readable<any>>] | Array<Readable<any>>;
@@ -13,4 +10,4 @@ type Stores = Readable<any> | [Readable<any>, ...Array<Readable<any>>] | Array<R
1310
type StoresValues<T> =
1411
T extends Readable<infer U> ? U : { [K in keyof T]: T[K] extends Readable<infer U> ? U : never };
1512

16-
export { Invalidator, SubscribeInvalidateTuple, Stores, StoresValues };
13+
export { SubscribeInvalidateTuple, Stores, StoresValues };

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import type { Invalidator } from './private.js';
2-
31
/** Callback to inform of a value updates. */
42
type Subscriber<T> = (value: T) => void;
53

@@ -30,7 +28,7 @@ interface Readable<T> {
3028
* @param run subscription callback
3129
* @param invalidate cleanup callback
3230
*/
33-
subscribe(this: void, run: Subscriber<T>, invalidate?: Invalidator): Unsubscriber;
31+
subscribe(this: void, run: Subscriber<T>, invalidate?: () => void): Unsubscriber;
3432
}
3533

3634
/** Writable interface for both updating and subscribing. */

0 commit comments

Comments
 (0)