question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Object is of type 'unknown' according to Vetur but TypeScript is able to infer the correct type + vue-cli-service build fails.

See original GitHub issue
  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: Windows 10 64bit Pro
  • Vetur version: 0.24.0
  • VS Code version: 1.44.2

Problem

Vetur is reporting the parameter is of type unknown even though TypeScript is able to derive the type GetLoggedInUserQuery.

image

Edit: Cannot build the app because of this.

Reproducible Case

  1. Setup @vue/composition-api for Vue 2
  2. Setup @vue/apollo-composable
  3. Use the useResult() helper of @vue/apollo-composable on your GraphQL query.
  4. Use the parameter (data from the screenshot) of the function from the third argument of the useResult() function.
  5. Vetur will report:

Object is of type “unknown”.

Even though TypeScript is able to derive the correct type.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
cerino-ligutomcommented, Jun 7, 2020

@octref Sure, here

4reactions
yoyo930021commented, Aug 5, 2020

The vue-cli-service isn’t vetur problem, but I also study about it.

  1. You’re missing two libraries (apollo-client graphql) in this repos.
  2. useGetLoggedInUserQuery have a type error.
  3. The @vue/apollo-composable library have a type error.

Maybe third problem is type problem in @vue/apollo-composable library, You can skipLibCheck: true in tsconfig.json for ignore it.

I fixed them, and then the project will build success.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Object is of type 'unknown'.Vetur(2571) when populating a ...
I assume the issue is I need to declare the type in the constant for each of the populate variables. Any ideas how...
Read more >
vuejs/vetur (Raised $789.00) - Issuehunt
Object is of type 'unknown' according to Vetur but TypeScript is able to infer the correct type + vue-cli-service build fails.
Read more >
[Solved]-How do I fix Vetur type error Typescript / Vue-Vue.js
The error indicates that tableMatch is an array of TableMatchInterface objects. Did you mean something like siteStore.tableMatch[0].slot.
Read more >
@vue/cli-plugin-typescript | Yarn - Package Manager
@vue/cli-plugin-typescript. typescript plugin for vue-cli. Uses TypeScript + ts-loader + fork-ts-checker-webpack-plugin for faster off-thread type checking.
Read more >
Adding Typescript to your existing VueJS 2.6+ app - Medium
This means you can add Typescript to your project and keep your source files unchanged. Pointless indeed, but it proves the retro-compatibility ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found