Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using defineComponent in Vue 2, unknown properties are infered to "any" #2505

Closed
4 tasks done
victorgarciaesgi opened this issue Dec 2, 2020 · 5 comments
Closed
4 tasks done
Labels

Comments

@victorgarciaesgi
Copy link

  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ
  • I have tried restarting VS Code or running Vetur: Restart VLS

Info

  • Platform:macOS
  • Vetur version: 0.30.3
  • VS Code version: 1.51.1

Problem

When using defineComponent from @vue/composition-api, unknown properties do not throw errors in template.

image

import { defineComponent } from '@nuxtjs/composition-api';

export default defineComponent({
     name: 'Test',
     setup(_, {root}) {
     // .....
     }
})
@yoyo930021
Copy link
Member

if you set "vetur.validation.interpolation": true?

The unknown properties are infered to "any".
This thing is correct.

@victorgarciaesgi
Copy link
Author

@yoyo930021 I had it activated already.

All my projet is written class-component style using (vue/nuxt)-property-decorators, and when I'm using a class, Vetur throws an error for unknown properties.
So I thought using defineComponent would have the same behaviour.

image

import { Component, Vue } from 'nuxt-property-decorator';

@Component({
// ...
})
export default class SocietyUuid extends Vue {
// ...
}

Current Vetur settings

{
  "vetur.validation.template": true,
  "vetur.validation.script": true,
  "vetur.format.defaultFormatter.html": "prettier",
  "vetur.validation.interpolation": true,
  "vetur.experimental.templateInterpolationService": true,
  "vetur.completion.autoImport": true,
  "vetur.completion.tagCasing": "initial",
  "vetur.validation.templateProps": true,
  "vetur.grammar.customBlocks": {
    "page-query": "graphql",
    "static-query": "graphql"
  },
}

@yoyo930021
Copy link
Member

It's a problem in @vue/compostion-api.

yoyo930021 added a commit to yoyo930021/vue2-composition-api-unknown-property that referenced this issue Dec 7, 2020
@yoyo930021
Copy link
Member

Fixed in @vue/composition-api in new release

@victorgarciaesgi
Copy link
Author

Thanks for the fast fix @yoyo930021! Massive respect for your work on Vetur!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants