Skip to content

Commit 9115eca

Browse files
committed
flesh out the distinction a bit more, deprecate subscribe
1 parent d0e3664 commit 9115eca

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Readable } from '../store/public.js';
1+
import { Readable, type Unsubscriber } from '../store/public.js';
22
import { SpringUpdateOpts, TweenedOptions, Updater, SpringOpts } from './private.js';
33

44
// TODO we do declaration merging here in order to not have a breaking change (renaming the Spring interface)
@@ -8,9 +8,13 @@ import { SpringUpdateOpts, TweenedOptions, Updater, SpringOpts } from './private
88
export interface Spring<T> extends Readable<T> {
99
set(new_value: T, opts?: SpringUpdateOpts): Promise<void>;
1010
/**
11-
* @deprecated Only exists on the Spring store
11+
* @deprecated Only exists on the legacy `spring` store, not the `Spring` class
1212
*/
1313
update: (fn: Updater<T>, opts?: SpringUpdateOpts) => Promise<void>;
14+
/**
15+
* @deprecated Only exists on the legacy `spring` store, not the `Spring` class
16+
*/
17+
subscribe(fn: (value: T) => void): Unsubscriber;
1418
precision: number;
1519
damping: number;
1620
stiffness: number;
@@ -65,12 +69,12 @@ export class Spring<T> {
6569
stiffness: number;
6670
/**
6771
* The end value of the spring.
68-
* This property only exists on the Spring class.
72+
* This property only exists on the `Spring` class, not the legacy `spring` store.
6973
*/
7074
target: T;
7175
/**
7276
* The current value of the spring.
73-
* This property only exists on the Spring class.
77+
* This property only exists on the `Spring` class, not the legacy `spring` store.
7478
*/
7579
get current(): T;
7680
}

packages/svelte/types/index.d.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,9 +1644,13 @@ declare module 'svelte/motion' {
16441644
export interface Spring<T> extends Readable<T> {
16451645
set(new_value: T, opts?: SpringUpdateOpts): Promise<void>;
16461646
/**
1647-
* @deprecated Only exists on the Spring store
1647+
* @deprecated Only exists on the legacy `spring` store, not the `Spring` class
16481648
*/
16491649
update: (fn: Updater<T>, opts?: SpringUpdateOpts) => Promise<void>;
1650+
/**
1651+
* @deprecated Only exists on the legacy `spring` store, not the `Spring` class
1652+
*/
1653+
subscribe(fn: (value: T) => void): Unsubscriber;
16501654
precision: number;
16511655
damping: number;
16521656
stiffness: number;
@@ -1701,12 +1705,12 @@ declare module 'svelte/motion' {
17011705
stiffness: number;
17021706
/**
17031707
* The end value of the spring.
1704-
* This property only exists on the Spring class.
1708+
* This property only exists on the `Spring` class, not the legacy `spring` store.
17051709
*/
17061710
target: T;
17071711
/**
17081712
* The current value of the spring.
1709-
* This property only exists on the Spring class.
1713+
* This property only exists on the `Spring` class, not the legacy `spring` store.
17101714
*/
17111715
get current(): T;
17121716
}

0 commit comments

Comments
 (0)