@@ -5,7 +5,7 @@ import { SpringUpdateOpts, TweenedOptions, Updater, SpringOpts } from './private
55// this means both the Spring class and the Spring interface are merged into one with some things only
66// existing on one side. In Svelte 6, remove the type definition and move the jsdoc onto the class in spring.js
77
8- export interface Spring < T > extends Readable < T > {
8+ export interface Spring < T extends number > extends Readable < T > {
99 set ( new_value : T , opts ?: SpringUpdateOpts ) : Promise < void > ;
1010 /**
1111 * @deprecated Only exists on the legacy `spring` store, not the `Spring` class
@@ -36,7 +36,7 @@ export interface Spring<T> extends Readable<T> {
3636 * ```
3737 * @since 5.8.0
3838 */
39- export class Spring < T > {
39+ export class Spring < T extends number > {
4040 constructor ( value : T , options ?: SpringOpts ) ;
4141
4242 /**
@@ -53,7 +53,7 @@ export class Spring<T> {
5353 * </script>
5454 * ```
5555 */
56- static of < U > ( fn : ( ) => U , options ?: SpringOpts ) : Spring < U > ;
56+ static of < U extends number > ( fn : ( ) => U , options ?: SpringOpts ) : Spring < U > ;
5757
5858 /**
5959 * Sets `spring.target` to `value` and returns a `Promise` that resolves if and when `spring.current` catches up to it.
@@ -80,7 +80,7 @@ export class Spring<T> {
8080 get current ( ) : T ;
8181}
8282
83- export interface Tweened < T > extends Readable < T > {
83+ export interface Tweened < T extends number > extends Readable < T > {
8484 set ( value : T , opts ?: TweenedOptions < T > ) : Promise < void > ;
8585 update ( updater : Updater < T > , opts ?: TweenedOptions < T > ) : Promise < void > ;
8686}
0 commit comments