]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(compiler): using guard instead of non-nullish assertion (#13982)
author沈青川 <46062972+ShenQingchuan@users.noreply.github.com>
Wed, 5 Nov 2025 09:12:23 +0000 (17:12 +0800)
committerGitHub <noreply@github.com>
Wed, 5 Nov 2025 09:12:23 +0000 (17:12 +0800)
packages/compiler-core/src/transforms/transformVBindShorthand.ts

index a6b989e734ac988f5c9b5c7a678a708d49d87558..210180822b61871f6028aa11b25d66029583f4c0 100644 (file)
@@ -19,9 +19,10 @@ export const transformVBindShorthand: NodeTransform = (node, context) => {
           // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
           (__BROWSER__ &&
             prop.exp.type === NodeTypes.SIMPLE_EXPRESSION &&
-            !prop.exp.content.trim()))
+            !prop.exp.content.trim())) &&
+        prop.arg
       ) {
-        const arg = prop.arg!
+        const arg = prop.arg
         if (arg.type !== NodeTypes.SIMPLE_EXPRESSION || !arg.isStatic) {
           // only simple expression is allowed for same-name shorthand
           context.onError(