From: Evan You Date: Mon, 20 Sep 2021 15:51:01 +0000 (-0400) Subject: fix(compiler-core): support ts syntax in expressions when isTS is true X-Git-Tag: v3.2.13~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0dc521b9e15ce4aa3d5229e90d2173644529e92b;p=thirdparty%2Fvuejs%2Fcore.git fix(compiler-core): support ts syntax in expressions when isTS is true --- diff --git a/packages/compiler-core/src/compile.ts b/packages/compiler-core/src/compile.ts index a3442fc8a0..95e3718964 100644 --- a/packages/compiler-core/src/compile.ts +++ b/packages/compiler-core/src/compile.ts @@ -85,6 +85,14 @@ export function baseCompile( const ast = isString(template) ? baseParse(template, options) : template const [nodeTransforms, directiveTransforms] = getBaseTransformPreset(prefixIdentifiers) + + if (!__BROWSER__ && options.isTS) { + const { expressionPlugins } = options + if (!expressionPlugins || !expressionPlugins.includes('typescript')) { + options.expressionPlugins = [...(expressionPlugins || []), 'typescript'] + } + } + transform( ast, extend({}, options, {