Skip to content

Commit 2873a00

Browse files
committed
fix type error
1 parent bb62915 commit 2873a00

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/parser/template.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,16 @@ export function parseTemplate(
2121
svelteAst: Compiler.Root | SvAST.AstLegacy;
2222
} {
2323
try {
24-
const svelteAst = parse(code, {
24+
const options: {
25+
filename?: string | undefined;
26+
modern: true;
27+
} = {
2528
filename: parserOptions.filePath,
26-
...(svelteVersion.gte(5) ? { modern: true } : {}),
27-
}) as never as Compiler.Root | SvAST.AstLegacy;
29+
...(svelteVersion.gte(5) ? { modern: true } : ({} as never)),
30+
};
31+
const svelteAst = parse(code, options) as never as
32+
| Compiler.Root
33+
| SvAST.AstLegacy;
2834
const ast = convertSvelteRoot(svelteAst, ctx);
2935

3036
return {

0 commit comments

Comments
 (0)