Skip to content

Commit e17a930

Browse files
committed
forgot one
1 parent d582e61 commit e17a930

File tree

5 files changed

+40
-40
lines changed

5 files changed

+40
-40
lines changed

packages/svelte/src/compiler/phases/1-parse/state/element.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** @import { Expression } from 'estree' */
2-
/** @import { AST, Directive, TemplateNode } from '#compiler' */
2+
/** @import { AST, Directive, ElementLike, TemplateNode } from '#compiler' */
33
/** @import { Parser } from '../index.js' */
44
import { is_void } from '../../../../utils.js';
55
import read_expression from '../read/expression.js';
@@ -26,7 +26,7 @@ const regex_valid_element_name =
2626
const regex_valid_component_name =
2727
/^(?:[A-Z][A-Za-z0-9_$.]*|[a-z][A-Za-z0-9_$]*(?:\.[A-Za-z0-9_$]+)+)$/;
2828

29-
/** @type {Map<string, AST.ElementLike['type']>} */
29+
/** @type {Map<string, ElementLike['type']>} */
3030
const root_only_meta_tags = new Map([
3131
['svelte:head', 'SvelteHead'],
3232
['svelte:options', 'SvelteOptions'],
@@ -35,7 +35,7 @@ const root_only_meta_tags = new Map([
3535
['svelte:body', 'SvelteBody']
3636
]);
3737

38-
/** @type {Map<string, AST.ElementLike['type']>} */
38+
/** @type {Map<string, ElementLike['type']>} */
3939
const meta_tags = new Map([
4040
...root_only_meta_tags,
4141
['svelte:element', 'SvelteElement'],
@@ -135,7 +135,7 @@ export default function element(parser) {
135135
? 'SlotElement'
136136
: 'RegularElement';
137137

138-
/** @type {AST.ElementLike} */
138+
/** @type {ElementLike} */
139139
const element =
140140
type === 'RegularElement'
141141
? {
@@ -153,7 +153,7 @@ export default function element(parser) {
153153
},
154154
parent: null
155155
}
156-
: /** @type {AST.ElementLike} */ ({
156+
: /** @type {ElementLike} */ ({
157157
type,
158158
start,
159159
end: -1,

packages/svelte/src/compiler/phases/2-analyze/visitors/shared/attribute.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @import { AST } from '#compiler' */
1+
/** @import { AST, ElementLike } from '#compiler' */
22
/** @import { Context } from '../../types' */
33
import * as e from '../../../../errors.js';
44
import { is_text_attribute } from '../../../../utils/ast.js';
@@ -22,7 +22,7 @@ export function validate_attribute_name(attribute) {
2222

2323
/**
2424
* @param {AST.Attribute} attribute
25-
* @param {AST.ElementLike} parent
25+
* @param {ElementLike} parent
2626
*/
2727
export function validate_attribute(attribute, parent) {
2828
if (

packages/svelte/src/compiler/phases/scope.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/** @import { ClassDeclaration, Expression, FunctionDeclaration, Identifier, ImportDeclaration, MemberExpression, Node, Pattern, VariableDeclarator } from 'estree' */
22
/** @import { Context, Visitor } from 'zimmerframe' */
3-
/** @import { AST, Binding, DeclarationKind, SvelteNode } from '#compiler' */
3+
/** @import { AST, Binding, DeclarationKind, ElementLike, SvelteNode } from '#compiler' */
44
import is_reference from 'is-reference';
55
import { walk } from 'zimmerframe';
66
import { create_expression_metadata } from './nodes.js';
@@ -289,7 +289,7 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
289289
};
290290

291291
/**
292-
* @type {Visitor<AST.ElementLike, State, SvelteNode>}
292+
* @type {Visitor<ElementLike, State, SvelteNode>}
293293
*/
294294
const SvelteFragment = (node, { state, next }) => {
295295
const scope = state.scope.child();

packages/svelte/src/compiler/types/template.d.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -376,21 +376,6 @@ export namespace AST {
376376
name: 'svelte:window';
377377
}
378378

379-
export type ElementLike =
380-
| Component
381-
| TitleElement
382-
| SlotElement
383-
| RegularElement
384-
| SvelteBody
385-
| SvelteComponent
386-
| SvelteDocument
387-
| SvelteElement
388-
| SvelteFragment
389-
| SvelteHead
390-
| SvelteOptionsRaw
391-
| SvelteSelf
392-
| SvelteWindow;
393-
394379
/** An `{#each ...}` block */
395380
export interface EachBlock extends BaseNode {
396381
type: 'EachBlock';
@@ -500,11 +485,26 @@ export type Directive =
500485

501486
export type Block = AST.EachBlock | AST.IfBlock | AST.AwaitBlock | AST.KeyBlock | AST.SnippetBlock;
502487

488+
export type ElementLike =
489+
| AST.Component
490+
| AST.TitleElement
491+
| AST.SlotElement
492+
| AST.RegularElement
493+
| AST.SvelteBody
494+
| AST.SvelteComponent
495+
| AST.SvelteDocument
496+
| AST.SvelteElement
497+
| AST.SvelteFragment
498+
| AST.SvelteHead
499+
| AST.SvelteOptionsRaw
500+
| AST.SvelteSelf
501+
| AST.SvelteWindow;
502+
503503
export type TemplateNode =
504504
| AST.Root
505505
| AST.Text
506506
| Tag
507-
| AST.ElementLike
507+
| ElementLike
508508
| AST.Attribute
509509
| AST.SpreadAttribute
510510
| Directive

packages/svelte/types/index.d.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,21 +1166,6 @@ declare module 'svelte/compiler' {
11661166
name: 'svelte:window';
11671167
}
11681168

1169-
export type ElementLike =
1170-
| Component
1171-
| TitleElement
1172-
| SlotElement
1173-
| RegularElement
1174-
| SvelteBody
1175-
| SvelteComponent
1176-
| SvelteDocument
1177-
| SvelteElement
1178-
| SvelteFragment
1179-
| SvelteHead
1180-
| SvelteOptionsRaw
1181-
| SvelteSelf
1182-
| SvelteWindow;
1183-
11841169
/** An `{#each ...}` block */
11851170
export interface EachBlock extends BaseNode {
11861171
type: 'EachBlock';
@@ -1263,6 +1248,21 @@ declare module 'svelte/compiler' {
12631248
| AST.UseDirective;
12641249

12651250
type Block = AST.EachBlock | AST.IfBlock | AST.AwaitBlock | AST.KeyBlock | AST.SnippetBlock;
1251+
1252+
type ElementLike =
1253+
| AST.Component
1254+
| AST.TitleElement
1255+
| AST.SlotElement
1256+
| AST.RegularElement
1257+
| AST.SvelteBody
1258+
| AST.SvelteComponent
1259+
| AST.SvelteDocument
1260+
| AST.SvelteElement
1261+
| AST.SvelteFragment
1262+
| AST.SvelteHead
1263+
| AST.SvelteOptionsRaw
1264+
| AST.SvelteSelf
1265+
| AST.SvelteWindow;
12661266
/**
12671267
* The preprocess function provides convenient hooks for arbitrarily transforming component source code.
12681268
* For example, it can be used to convert a <style lang="sass"> block into vanilla CSS.

0 commit comments

Comments
 (0)