Skip to content

Commit c173140

Browse files
authored
chore: use JSDoc import (#12595)
* more * more * more
1 parent 8d13921 commit c173140

File tree

12 files changed

+88
-77
lines changed

12 files changed

+88
-77
lines changed

packages/svelte/src/internal/client/dom/blocks/each.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function index(_, i) {
5959
* @param {EachState} state
6060
* @param {EachItem[]} items
6161
* @param {null | Node} controlled_anchor
62-
* @param {Map<any, import("#client").EachItem>} items_map
62+
* @param {Map<any, EachItem>} items_map
6363
*/
6464
function pause_effects(state, items, controlled_anchor, items_map) {
6565
/** @type {TransitionManager[]} */

packages/svelte/src/internal/client/dom/blocks/if.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @import { TemplateNode } from '#client' */
1+
/** @import { Effect, TemplateNode } from '#client' */
22
import { EFFECT_TRANSPARENT } from '../../constants.js';
33
import {
44
hydrate_next,
@@ -14,8 +14,8 @@ import { HYDRATION_START_ELSE } from '../../../../constants.js';
1414
/**
1515
* @param {TemplateNode} node
1616
* @param {() => boolean} get_condition
17-
* @param {(anchor: Node) => import('#client').Dom} consequent_fn
18-
* @param {null | ((anchor: Node) => import('#client').Dom)} [alternate_fn]
17+
* @param {(anchor: Node) => void} consequent_fn
18+
* @param {null | ((anchor: Node) => void)} [alternate_fn]
1919
* @param {boolean} [elseif] True if this is an `{:else if ...}` block rather than an `{#if ...}`, as that affects which transitions are considered 'local'
2020
* @returns {void}
2121
*/
@@ -26,10 +26,10 @@ export function if_block(node, get_condition, consequent_fn, alternate_fn = null
2626

2727
var anchor = node;
2828

29-
/** @type {import('#client').Effect | null} */
29+
/** @type {Effect | null} */
3030
var consequent_effect = null;
3131

32-
/** @type {import('#client').Effect | null} */
32+
/** @type {Effect | null} */
3333
var alternate_effect = null;
3434

3535
/** @type {boolean | null} */

packages/svelte/src/internal/client/dom/elements/transitions.js

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** @import { AnimateFn, Animation, AnimationConfig, EachItem, Effect, Task, TransitionFn, TransitionManager } from '#client' */
12
import { noop, is_function } from '../../../shared/utils.js';
23
import { effect } from '../../reactivity/effects.js';
34
import { current_effect, untrack } from '../../runtime.js';
@@ -60,19 +61,19 @@ const linear = (t) => t;
6061
* and attaches it to the block, so that moves can be animated following reconciliation.
6162
* @template P
6263
* @param {Element} element
63-
* @param {() => import('#client').AnimateFn<P | undefined>} get_fn
64+
* @param {() => AnimateFn<P | undefined>} get_fn
6465
* @param {(() => P) | null} get_params
6566
*/
6667
export function animation(element, get_fn, get_params) {
67-
var item = /** @type {import('#client').EachItem} */ (current_each_item);
68+
var item = /** @type {EachItem} */ (current_each_item);
6869

6970
/** @type {DOMRect} */
7071
var from;
7172

7273
/** @type {DOMRect} */
7374
var to;
7475

75-
/** @type {import('#client').Animation | undefined} */
76+
/** @type {Animation | undefined} */
7677
var animation;
7778

7879
/** @type {null | { position: string, width: string, height: string, transform: string }} */
@@ -167,7 +168,7 @@ export function animation(element, get_fn, get_params) {
167168
* @template P
168169
* @param {number} flags
169170
* @param {HTMLElement} element
170-
* @param {() => import('#client').TransitionFn<P | undefined>} get_fn
171+
* @param {() => TransitionFn<P | undefined>} get_fn
171172
* @param {(() => P) | null} get_params
172173
* @returns {void}
173174
*/
@@ -180,15 +181,15 @@ export function transition(flags, element, get_fn, get_params) {
180181
/** @type {'in' | 'out' | 'both'} */
181182
var direction = is_both ? 'both' : is_intro ? 'in' : 'out';
182183

183-
/** @type {import('#client').AnimationConfig | ((opts: { direction: 'in' | 'out' }) => import('#client').AnimationConfig) | undefined} */
184+
/** @type {AnimationConfig | ((opts: { direction: 'in' | 'out' }) => AnimationConfig) | undefined} */
184185
var current_options;
185186

186187
var inert = element.inert;
187188

188-
/** @type {import('#client').Animation | undefined} */
189+
/** @type {Animation | undefined} */
189190
var intro;
190191

191-
/** @type {import('#client').Animation | undefined} */
192+
/** @type {Animation | undefined} */
192193
var outro;
193194

194195
/** @type {(() => void) | undefined} */
@@ -201,7 +202,7 @@ export function transition(flags, element, get_fn, get_params) {
201202
return (current_options ??= get_fn()(element, get_params?.(), { direction }));
202203
}
203204

204-
/** @type {import('#client').TransitionManager} */
205+
/** @type {TransitionManager} */
205206
var transition = {
206207
is_global,
207208
in() {
@@ -271,7 +272,7 @@ export function transition(flags, element, get_fn, get_params) {
271272
}
272273
};
273274

274-
var e = /** @type {import('#client').Effect} */ (current_effect);
275+
var e = /** @type {Effect} */ (current_effect);
275276

276277
(e.transitions ??= []).push(transition);
277278

@@ -282,7 +283,7 @@ export function transition(flags, element, get_fn, get_params) {
282283
let run = is_global;
283284

284285
if (!run) {
285-
var block = /** @type {import('#client').Effect | null} */ (e.parent);
286+
var block = /** @type {Effect | null} */ (e.parent);
286287

287288
// skip over transparent blocks (e.g. snippets, else-if blocks)
288289
while (block && (block.f & EFFECT_TRANSPARENT) !== 0) {
@@ -305,12 +306,12 @@ export function transition(flags, element, get_fn, get_params) {
305306
/**
306307
* Animates an element, according to the provided configuration
307308
* @param {Element} element
308-
* @param {import('#client').AnimationConfig | ((opts: { direction: 'in' | 'out' }) => import('#client').AnimationConfig)} options
309-
* @param {import('#client').Animation | undefined} counterpart The corresponding intro/outro to this outro/intro
309+
* @param {AnimationConfig | ((opts: { direction: 'in' | 'out' }) => AnimationConfig)} options
310+
* @param {Animation | undefined} counterpart The corresponding intro/outro to this outro/intro
310311
* @param {number} t2 The target `t` value — `1` for intro, `0` for outro
311312
* @param {(() => void) | undefined} on_finish Called after successfully completing the animation
312313
* @param {(() => void) | undefined} on_abort Called if the animation is aborted
313-
* @returns {import('#client').Animation}
314+
* @returns {Animation}
314315
*/
315316
function animate(element, options, counterpart, t2, on_finish, on_abort) {
316317
var is_intro = t2 === 1;
@@ -319,7 +320,7 @@ function animate(element, options, counterpart, t2, on_finish, on_abort) {
319320
// In the case of a deferred transition (such as `crossfade`), `option` will be
320321
// a function rather than an `AnimationConfig`. We need to call this function
321322
// once DOM has been updated...
322-
/** @type {import('#client').Animation} */
323+
/** @type {Animation} */
323324
var a;
324325

325326
queue_micro_task(() => {
@@ -358,10 +359,10 @@ function animate(element, options, counterpart, t2, on_finish, on_abort) {
358359
var duration = options.duration * Math.abs(delta);
359360
var end = start + duration;
360361

361-
/** @type {Animation} */
362+
/** @type {globalThis.Animation} */
362363
var animation;
363364

364-
/** @type {import('#client').Task} */
365+
/** @type {Task} */
365366
var task;
366367

367368
if (css) {

packages/svelte/src/internal/client/reactivity/deriveds.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** @import { Derived } from '#client' */
12
import { CLEAN, DERIVED, DESTROYED, DIRTY, MAYBE_DIRTY, UNOWNED } from '../constants.js';
23
import {
34
current_reaction,
@@ -16,14 +17,14 @@ export let updating_derived = false;
1617
/**
1718
* @template V
1819
* @param {() => V} fn
19-
* @returns {import('#client').Derived<V>}
20+
* @returns {Derived<V>}
2021
*/
2122
/*#__NO_SIDE_EFFECTS__*/
2223
export function derived(fn) {
2324
let flags = DERIVED | DIRTY;
2425
if (current_effect === null) flags |= UNOWNED;
2526

26-
/** @type {import('#client').Derived<V>} */
27+
/** @type {Derived<V>} */
2728
const signal = {
2829
deps: null,
2930
deriveds: null,
@@ -38,7 +39,7 @@ export function derived(fn) {
3839
};
3940

4041
if (current_reaction !== null && (current_reaction.f & DERIVED) !== 0) {
41-
var current_derived = /** @type {import('#client').Derived} */ (current_reaction);
42+
var current_derived = /** @type {Derived} */ (current_reaction);
4243
if (current_derived.deriveds === null) {
4344
current_derived.deriveds = [signal];
4445
} else {
@@ -52,7 +53,7 @@ export function derived(fn) {
5253
/**
5354
* @template V
5455
* @param {() => V} fn
55-
* @returns {import('#client').Derived<V>}
56+
* @returns {Derived<V>}
5657
*/
5758
/*#__NO_SIDE_EFFECTS__*/
5859
export function derived_safe_equal(fn) {
@@ -62,7 +63,7 @@ export function derived_safe_equal(fn) {
6263
}
6364

6465
/**
65-
* @param {import('#client').Derived} derived
66+
* @param {Derived} derived
6667
* @returns {void}
6768
*/
6869
function destroy_derived_children(derived) {
@@ -79,7 +80,7 @@ function destroy_derived_children(derived) {
7980
}
8081

8182
/**
82-
* @param {import('#client').Derived} derived
83+
* @param {Derived} derived
8384
* @returns {void}
8485
*/
8586
export function update_derived(derived) {
@@ -103,7 +104,7 @@ export function update_derived(derived) {
103104
}
104105

105106
/**
106-
* @param {import('#client').Derived} signal
107+
* @param {Derived} signal
107108
* @returns {void}
108109
*/
109110
export function destroy_derived(signal) {

0 commit comments

Comments
 (0)