Skip to content

Commit 8f02f1e

Browse files
committed
add ElementWithPath interface
1 parent eb59f72 commit 8f02f1e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { AST, Binding, Css, SvelteNode, TemplateNode } from '#compiler';
1+
import type { AST, Binding, Css, ElementWithPath, SvelteNode } from '#compiler';
22
import type { Identifier, LabeledStatement, Program, VariableDeclaration } from 'estree';
33
import type { Scope, ScopeRoot } from './scope.js';
44

@@ -37,10 +37,7 @@ export interface ComponentAnalysis extends Analysis {
3737
instance: Js;
3838
template: Template;
3939
/** Used for CSS pruning and scoping */
40-
elements: Array<{
41-
node: AST.RegularElement | AST.SvelteElement | AST.RenderTag;
42-
path: SvelteNode[];
43-
}>;
40+
elements: ElementWithPath[];
4441
runes: boolean;
4542
exports: Array<{ name: string; alias: string | null }>;
4643
/** Whether the component uses `$$props` */

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,11 @@ export type TemplateNode =
514514

515515
export type SvelteNode = Node | TemplateNode | AST.Fragment | Css.Node;
516516

517+
export interface ElementWithPath {
518+
node: AST.RegularElement | AST.SvelteElement | AST.RenderTag;
519+
path: SvelteNode[];
520+
}
521+
517522
declare module 'estree' {
518523
export interface BaseNode {
519524
/** Added by the Svelte parser */

0 commit comments

Comments
 (0)