Using vue-meta in typescript causing vetur to trigger false-positive errors
See original GitHub issueInfo
- Platform: macOS
- Vetur version: 0.21.0
- VS Code version: 1.35.1
Problem
Main error:
Object literal may only specify known properties, and 'metaInfo' does not exist in type 'ComponentOptions<{ deviceType: DeviceType; isDesktop: boolean; isTablet: boolean; isMobile: boolean; } & Record<never, any> & Vue, DefaultData<{ deviceType: DeviceType; isDesktop: boolean; isTablet: boolean; isMobile: boolean; } & Record<...> & Vue>, DefaultMethods<...>, DefaultComputed, PropsDefinition<...>, Record...'.Vetur(2345)
and a lot of errors in computed
and methods
sections like this:
Property '$store' does not exist on type '{ ... }'. Vetur(2339)
...
Property 'deviceType' does not exist on type '{ ... }'.Vetur(2339)
As you can see on this gif we have a lot of false-positive (tsc
compiles just fine) errors that disappear after commenting the line with declaring metaInfo
option
Reproducible Case
Just try to use vue-meta with typescript Vue components (<script lang="ts">...</script>
)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Using vue-meta in typescript causing vetur to trigger false ...
Using vue-meta in typescript causing vetur to trigger false-positive errors #1344. yekver posted onGitHub. I have searched through existing issues
Read more >Nuxt `head` property shows errors when using computed ...
Within this, if I access computed properties, Vetur shows: Property 'domain' does not exist on type 'CombinedVueInstance {...}>'.
Read more >[Solved]-How do I fix Vetur type error Typescript / Vue-Vue.js
Coding example for the question How do I fix Vetur type error Typescript ... that you already have a real value and not...
Read more >How To Change Metadata in Vue.js with vue-meta
Learn how to use vue-meta to change the title and meta tags in your Vue.js apps.
Read more >ESLint plugin for Prettier formatting
(If another active ESLint rule disagrees with prettier about how code should be formatted, it will be impossible to avoid lint errors.) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Because you are not importing
vue-meta
in any TS file in your project. You need to add import statement forvue-meta
to load its typing.I’ve created a repro here: https://github.com/yekver/ts_vue-meta You can see this bug in
src/App.vue
.