Subscribe on changes!

[compiler-sfc]: Bug attribute binding syntaxes result in different AST nodes

avatar
Mar 15th 2022

Version

3.2.31

Reproduction link

github.com branch compiler-sfc-attr-binding

Steps to reproduce

  • Clone the repo
  • Install dependencies with yarn
  • Open src/App.vue. In this file there is an <input> contains 2 equivalent attribute binding syntaxes ^<name> and :<name>.attr
  • Run yarn test

What is expected?

Since these 2 attribute binding syntaxes are equivalent, the AST node should have similar type, which is type 7 and even better, the generated AST nodes should be the same.

What is actually happening?

After run yarn test in the reproduce repo, observe in the console that type: 6 applies to syntax ^<name> while type 7 applies to syntax :<name>.attr


Currently, because of this difference, it causes the issue for vue-tsc to perform type checking properly, see https://github.com/johnsoncodehk/volar/pull/1047