Skip to content

Commit 4da65c5

Browse files
committed
fix: ensure AST analysis on svelte.js modules succeeds
This was the result of a `@ts-expect-error` silencing other type errors, which lead to this creeping in. This changes it so that the object is fully set, so we'll get type errors when new properties need to be added fixes #15284
1 parent b6bf735 commit 4da65c5

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

.changeset/good-spiders-own.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: ensure AST analysis on `svelte.js` modules succeeds

packages/svelte/src/compiler/phases/2-analyze/index.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,20 @@ export function analyze_module(ast, options) {
258258
{
259259
scope,
260260
scopes,
261-
// @ts-expect-error TODO
262-
analysis
261+
analysis: /** @type {ComponentAnalysis} */ (analysis),
262+
derived_state: [],
263+
// TODO the following are not needed for modules, but we have to pass them in order to avoid type error,
264+
// and reducing the type would result in a lot of tedious type casts elsewhere - find a good solution one day
265+
ast_type: /** @type {any} */ (null),
266+
component_slots: new Set(),
267+
expression: null,
268+
function_depth: 0,
269+
has_props_rune: false,
270+
instance_scope: /** @type {any} */ (null),
271+
options: /** @type {ValidatedCompileOptions} */ (options),
272+
parent_element: null,
273+
reactive_statement: null,
274+
reactive_statements: new Map()
263275
},
264276
visitors
265277
);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy