|
1 | | -/** @import { Expression, Node, Program } from 'estree' */ |
| 1 | +/** @import * as ESTree from 'estree' */ |
2 | 2 | /** @import { Binding, AST, ValidatedCompileOptions, ValidatedModuleCompileOptions } from '#compiler' */ |
3 | 3 | /** @import { AnalysisState, Visitors } from './types' */ |
4 | 4 | /** @import { Analysis, ComponentAnalysis, Js, ReactiveStatement, Template } from '../types' */ |
@@ -206,7 +206,7 @@ const visitors = { |
206 | 206 | * @returns {Js} |
207 | 207 | */ |
208 | 208 | function js(script, root, allow_reactive_declarations, parent) { |
209 | | - /** @type {Program} */ |
| 209 | + /** @type {ESTree.Program} */ |
210 | 210 | const ast = script?.content ?? { |
211 | 211 | type: 'Program', |
212 | 212 | sourceType: 'module', |
@@ -289,7 +289,7 @@ export function analyze_module(source, options) { |
289 | 289 | }); |
290 | 290 |
|
291 | 291 | walk( |
292 | | - /** @type {Node} */ (ast), |
| 292 | + /** @type {ESTree.Node} */ (ast), |
293 | 293 | { |
294 | 294 | scope, |
295 | 295 | scopes, |
@@ -347,7 +347,7 @@ export function analyze_component(root, source, options) { |
347 | 347 |
|
348 | 348 | const store_name = name.slice(1); |
349 | 349 | const declaration = instance.scope.get(store_name); |
350 | | - const init = /** @type {Node | undefined} */ (declaration?.initial); |
| 350 | + const init = /** @type {ESTree.Node | undefined} */ (declaration?.initial); |
351 | 351 |
|
352 | 352 | // If we're not in legacy mode through the compiler option, assume the user |
353 | 353 | // is referencing a rune and not a global store. |
@@ -407,7 +407,7 @@ export function analyze_component(root, source, options) { |
407 | 407 | /** @type {number} */ (node.start) > /** @type {number} */ (module.ast.start) && |
408 | 408 | /** @type {number} */ (node.end) < /** @type {number} */ (module.ast.end) && |
409 | 409 | // const state = $state(0) is valid |
410 | | - get_rune(/** @type {Node} */ (path.at(-1)), module.scope) === null |
| 410 | + get_rune(/** @type {ESTree.Node} */ (path.at(-1)), module.scope) === null |
411 | 411 | ) { |
412 | 412 | e.store_invalid_subscription(node); |
413 | 413 | } |
@@ -636,7 +636,7 @@ export function analyze_component(root, source, options) { |
636 | 636 | // @ts-expect-error |
637 | 637 | _: set_scope, |
638 | 638 | Identifier(node, context) { |
639 | | - const parent = /** @type {Expression} */ (context.path.at(-1)); |
| 639 | + const parent = /** @type {ESTree.Expression} */ (context.path.at(-1)); |
640 | 640 |
|
641 | 641 | if (is_reference(node, parent)) { |
642 | 642 | const binding = context.state.scope.get(node.name); |
|
0 commit comments