Composition-api: Vetur unable to type template

Created on 29 Aug 2019  路  5Comments  路  Source: vuejs/composition-api

Vetur was able to type the variables in the template properly in VSCode with the previous vue-function-api.

Somehow it stops working after upgrading to @vue/composition-api.

Please see the two branches:

  1. Using vue-function-api https://github.com/ycmjason/perfect-colour
    image

  2. Using @vue/composition-api https://github.com/ycmjason/perfect-colour/tree/upgrade-to-composition-api
    image
    The error reads:

Property 'answerRGB' does not exist on type 'never'.

Note on my VSCode config:

  1. "vetur.useWorkspaceDependencies": true,
  2. "vetur.experimental.templateInterpolationService": true,

Most helpful comment

It still doesn't work perfectly as before. Although it doesn't give those Property (...) does not exist on type 'never'. errors anymore, now all variables referenced in <template> have their type inferred as any.

All 5 comments

It still doesn't work perfectly as before. Although it doesn't give those Property (...) does not exist on type 'never'. errors anymore, now all variables referenced in <template> have their type inferred as any.

@lbssousa Any news on this? I'm getting all the unknown properties infered as any too using defineComponent

@victorgarciaesgi the types should work on the template.

I recommend asking on Discord #typescript or #composition-api, because it most likely one of the typescript with vue pitfalls.

I stumbled on this as well. Maybe this is the issue: https://github.com/vuejs/vetur/issues/1874

Was this page helpful?
0 / 5 - 0 ratings