fix(compiler): using guard instead of non-nullish assertion (#13982)

This commit is contained in:
沈青川 2025-11-05 17:12:23 +08:00 committed by GitHub
parent 8fbe48fe39
commit dcc6f36257
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View 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(