fix: ensure AST analysis on `svelte.js` modules succeeds (#15297)

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
pull/15279/head
Simon H 7 months ago committed by GitHub
parent 8b977253f3
commit 7e3253745e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: ensure AST analysis on `svelte.js` modules succeeds

@ -258,8 +258,20 @@ export function analyze_module(ast, options) {
{
scope,
scopes,
// @ts-expect-error TODO
analysis
analysis: /** @type {ComponentAnalysis} */ (analysis),
derived_state: [],
// TODO the following are not needed for modules, but we have to pass them in order to avoid type error,
// and reducing the type would result in a lot of tedious type casts elsewhere - find a good solution one day
ast_type: /** @type {any} */ (null),
component_slots: new Set(),
expression: null,
function_depth: 0,
has_props_rune: false,
instance_scope: /** @type {any} */ (null),
options: /** @type {ValidatedCompileOptions} */ (options),
parent_element: null,
reactive_statement: null,
reactive_statements: new Map()
},
visitors
);

Loading…
Cancel
Save