Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 84325bf

Browse files
damianstasikRich-Harris
andauthoredJul 2, 2024
chore: use JSDoc type imports in more files (#12239)
* chore: use JSDoc type imports in more files * Location_1 -> Location * merge * fix * oops --------- Co-authored-by: Rich Harris <[email protected]>
1 parent bcf23ca commit 84325bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+818
-742
lines changed
 

‎packages/svelte/src/animate/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/** @import { FlipParams, AnimationConfig } from './public.js' */
12
import { cubicOut } from '../easing/index.js';
23

34
/**
@@ -7,8 +8,8 @@ import { cubicOut } from '../easing/index.js';
78
* https://svelte.dev/docs/svelte-animate#flip
89
* @param {Element} node
910
* @param {{ from: DOMRect; to: DOMRect }} fromTo
10-
* @param {import('./public.js').FlipParams} params
11-
* @returns {import('./public.js').AnimationConfig}
11+
* @param {FlipParams} params
12+
* @returns {AnimationConfig}
1213
*/
1314
export function flip(node, { from, to }, params = {}) {
1415
const style = getComputedStyle(node);

‎packages/svelte/src/compiler/index.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/** @import { LegacyRoot } from './types/legacy-nodes.js' */
2+
/** @import { CompileOptions, CompileResult, ValidatedCompileOptions, ModuleCompileOptions, Root } from '#compiler' */
13
import { walk as zimmerframe_walk } from 'zimmerframe';
24
import { convert } from './legacy.js';
35
import { parse as parse_acorn } from './phases/1-parse/acorn.js';
@@ -14,8 +16,8 @@ export { default as preprocess } from './preprocess/index.js';
1416
*
1517
* https://svelte.dev/docs/svelte-compiler#svelte-compile
1618
* @param {string} source The component source code
17-
* @param {import('#compiler').CompileOptions} options The compiler options
18-
* @returns {import('#compiler').CompileResult}
19+
* @param {CompileOptions} options The compiler options
20+
* @returns {CompileResult}
1921
*/
2022
export function compile(source, options) {
2123
const validated = validate_component_options(options, '');
@@ -25,7 +27,7 @@ export function compile(source, options) {
2527

2628
const { customElement: customElementOptions, ...parsed_options } = parsed.options || {};
2729

28-
/** @type {import('#compiler').ValidatedCompileOptions} */
30+
/** @type {ValidatedCompileOptions} */
2931
const combined_options = {
3032
...validated,
3133
...parsed_options,
@@ -52,8 +54,8 @@ export function compile(source, options) {
5254
*
5355
* https://svelte.dev/docs/svelte-compiler#svelte-compile
5456
* @param {string} source The component source code
55-
* @param {import('#compiler').ModuleCompileOptions} options
56-
* @returns {import('#compiler').CompileResult}
57+
* @param {ModuleCompileOptions} options
58+
* @returns {CompileResult}
5759
*/
5860
export function compileModule(source, options) {
5961
const validated = validate_module_options(options, '');
@@ -73,7 +75,7 @@ export function compileModule(source, options) {
7375
* @overload
7476
* @param {string} source
7577
* @param {{ filename?: string; modern: true }} options
76-
* @returns {import('#compiler').Root}
78+
* @returns {Root}
7779
*/
7880

7981
/**
@@ -86,7 +88,7 @@ export function compileModule(source, options) {
8688
* @overload
8789
* @param {string} source
8890
* @param {{ filename?: string; modern?: false }} [options]
89-
* @returns {import('./types/legacy-nodes.js').LegacyRoot}
91+
* @returns {LegacyRoot}
9092
*/
9193

9294
/**
@@ -98,7 +100,7 @@ export function compileModule(source, options) {
98100
* https://svelte.dev/docs/svelte-compiler#svelte-parse
99101
* @param {string} source
100102
* @param {{ filename?: string; rootDir?: string; modern?: boolean }} [options]
101-
* @returns {import('#compiler').Root | import('./types/legacy-nodes.js').LegacyRoot}
103+
* @returns {Root | LegacyRoot}
102104
*/
103105
export function parse(source, { filename, rootDir, modern } = {}) {
104106
state.reset(source, { filename, rootDir }); // TODO it's weird to require filename/rootDir here. reconsider the API
@@ -109,7 +111,7 @@ export function parse(source, { filename, rootDir, modern } = {}) {
109111

110112
/**
111113
* @param {string} source
112-
* @param {import('#compiler').Root} ast
114+
* @param {Root} ast
113115
* @param {boolean | undefined} modern
114116
*/
115117
function to_public_ast(source, ast, modern) {

0 commit comments

Comments
 (0)
Please sign in to comment.