diff --git a/packages/svelte/src/internal/client/reactivity/sources.js b/packages/svelte/src/internal/client/reactivity/sources.js index 66ef4a64e9..f2012e7065 100644 --- a/packages/svelte/src/internal/client/reactivity/sources.js +++ b/packages/svelte/src/internal/client/reactivity/sources.js @@ -6,7 +6,7 @@ import { CLEAN, SOURCE } from '../constants.js'; /** * @template V * @param {V} initial_value - * @returns {import('../types.js').Source} + * @returns {import('./types.js').Source} */ /*#__NO_SIDE_EFFECTS__*/ export function source(initial_value) { @@ -16,7 +16,7 @@ export function source(initial_value) { /** * @template V * @param {V} initial_value - * @returns {import('../types.js').Source} + * @returns {import('./types.js').Source} */ /*#__NO_SIDE_EFFECTS__*/ export function mutable_source(initial_value) { @@ -36,7 +36,7 @@ export function mutable_source(initial_value) { * @template V * @param {import('../types.js').SignalFlags} flags * @param {V} value - * @returns {import('../types.js').Source | import('../types.js').Source & import('../types.js').SourceDebug} + * @returns {import('./types.js').Source | import('./types.js').Source & import('./types.js').SourceDebug} */ function create_source_signal(flags, value) { if (DEV) { diff --git a/packages/svelte/src/internal/client/reactivity/store.js b/packages/svelte/src/internal/client/reactivity/store.js index 1014098819..5ffb4da2d1 100644 --- a/packages/svelte/src/internal/client/reactivity/store.js +++ b/packages/svelte/src/internal/client/reactivity/store.js @@ -50,7 +50,7 @@ export function store_get(store, store_name, stores) { /** * @template V * @param {import('../types.js').Store | null | undefined} store - * @param {import('../types.js').Source} source + * @param {import('./types.js').Source} source */ function connect_store_to_signal(store, source) { if (store == null) { diff --git a/packages/svelte/src/internal/client/reactivity/types.d.ts b/packages/svelte/src/internal/client/reactivity/types.d.ts new file mode 100644 index 0000000000..80f3eb756a --- /dev/null +++ b/packages/svelte/src/internal/client/reactivity/types.d.ts @@ -0,0 +1,19 @@ +import type { Computation, EqualsFunctions, SignalFlags } from '../types'; + +export type Source = { + /** consumers: Signals that read from the current signal */ + c: null | Computation[]; + /** equals: For value equality */ + e: null | EqualsFunctions; + /** flags: The types that the signal represent, as a bitwise value */ + f: SignalFlags; + /** value: The latest value for this signal */ + v: V; + // write version + w: number; +}; + +export type SourceDebug = { + /** This is DEV only */ + inspect: Set; +}; diff --git a/packages/svelte/src/internal/client/types.d.ts b/packages/svelte/src/internal/client/types.d.ts index 59cf49e9d0..5130c7a2f6 100644 --- a/packages/svelte/src/internal/client/types.d.ts +++ b/packages/svelte/src/internal/client/types.d.ts @@ -1,4 +1,5 @@ import { DERIVED, EFFECT, RENDER_EFFECT, SOURCE, PRE_EFFECT, STATE_SYMBOL } from './constants.js'; +import type { Source, SourceDebug } from './reactivity/types.js'; // Put all internal types in this file. Once we convert to JSDoc, we can make this a d.ts file @@ -55,24 +56,6 @@ export type ComponentContext = { // (effects and derived signals). Thus we can improve the memory profile at the slight cost // of some runtime performance. -export type Source = { - /** consumers: Signals that read from the current signal */ - c: null | Computation[]; - /** equals: For value equality */ - e: null | EqualsFunctions; - /** flags: The types that the signal represent, as a bitwise value */ - f: SignalFlags; - /** value: The latest value for this signal */ - v: V; - // write version - w: number; -}; - -export type SourceDebug = { - /** This is DEV only */ - inspect: Set; -}; - export type Computation = { /** consumers: Signals that read from the current signal */ c: null | Computation[];