From 0f65e0665476f45dc79cbc766b05a32c5941d1ee Mon Sep 17 00:00:00 2001 From: KazariEX <1364035137@qq.com> Date: Sun, 11 Aug 2024 01:16:34 +0800 Subject: [PATCH] fix: ployfill for missing function in tsc --- packages/language-core/lib/codegen/template/element.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/language-core/lib/codegen/template/element.ts b/packages/language-core/lib/codegen/template/element.ts index 33a3de6970..6819c61fdf 100644 --- a/packages/language-core/lib/codegen/template/element.ts +++ b/packages/language-core/lib/codegen/template/element.ts @@ -595,7 +595,7 @@ function* generateReferencesForScopedCssClasses( ts.forEachChild(ast, node => { if ( !ts.isExpressionStatement(node) || - !ts.isTemplateExpression(node.expression) + !isTemplateExpression(node.expression) ) return; const expression = node.expression.templateSpans[0].expression; @@ -694,4 +694,9 @@ function collectClasses(content: string, startOffset = 0) { } } return classes; +} + +// isTemplateExpression is missing in tsc +function isTemplateExpression(node: ts.Node): node is ts.TemplateExpression { + return node.kind === 228 satisfies ts.SyntaxKind.TemplateExpression; } \ No newline at end of file