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.

TS: 2339: Property 'xxx' does not exist on type 'CombinedVueInstance<Vue, object, object, object, Record<never, any>>'

See original GitHub issue

🐛 Bug Report

I have a Vue project with Typescript where I also use vue-test-utils. So in order to test components a Wrapper is used. This looks like this most of the time:

const wrapper: Wrapper<InstanceType<typeof SomeComponent>>;
wrapper = mount(SomeComponent, <options>);

it ('test', () => {
  expect(wrapper.vm.someprop).toBe(true);
})

Hence, the wrapper has a pretty extensive type now. But when I run jest, ts-jest is stating that someprop does not exist on type CombinedVueInstance<Vue, object, object, object, Record<never, any>>, but that is not the type of wrapper.vm.

To Reproduce

Steps to reproduce the behavior:

Expected behavior

ts-jest should use the correct type.

Link to repo (highly encouraged)

Sorry, private project

Debug log:

# content of ts-jest.log :

envinfo

System:
    OS: Windows 10 10.0.19042
    CPU: (16) x64 Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz
    Memory: 5.35 GB / 15.75 GB
  Binaries:
    Node: 14.17.3
    Yarn: 1.22.4
    npm: 7.20.6
  Utilities:
    Git: 2.27.0.
  IDEs:
    VSCode: 1.59.0
  Languages:
    Java: 11.0.2
  Browsers:
    Edge: Spartan (44.19041.423.0)
    Internet Explorer: 11.0.19041.1
  Npm packages:
    jest:
`-- @vue/cli-plugin-unit-jest@4.5.13
  +-- jest@24.9.0
  `-- ts-jest@24.3.0
    `-- jest@24.9.0 deduped
    ts-jest:
`-- @vue/cli-plugin-unit-jest@4.5.13
  `-- ts-jest@24.3.0
    typescript:
+-- @typescript-eslint/eslint-plugin@4.29.2
| `-- tsutils@3.21.0
|   `-- typescript@4.3.5 deduped
+-- @vue/cli-plugin-typescript@4.5.13
| +-- ts-loader@6.2.2
| | `-- typescript@4.3.5 deduped
| +-- tslint@5.20.1
| | +-- tsutils@2.29.0
| | | `-- typescript@4.3.5 deduped
| | `-- typescript@4.3.5 deduped
| `-- typescript@4.3.5 deduped
`-- typescript@4.3.5

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16

github_iconTop GitHub Comments

1reaction
sschneider-ihre-pvscommented, Aug 27, 2021
0reactions
sschneider-ihre-pvscommented, Aug 31, 2021

@lmiller1990 originally, yes, that complex type from above was, in my eyes, the correct one. Sadly now vscode and ts-jest agreed on torturing me with the CombinedVueInstance which doesn’t work with Wrapper<InstanceType<typeof CustomComponent>>. now it pretty much boils down to the shim of Wrapper<CombinedVueInstance<jadda,jadda>>

Read more comments on GitHub >

github_iconTop Results From Across the Web

Property 'XXX' does not exist on type 'CombinedVueInstance ...
Solution: i have added declaration to component. <script lang="ts"> import Vue from 'vue'; // Add ...
Read more >
Property 'xxx' does not exist on type ... - GitHub
Property 'xxx' does not exist on type 'CombinedVueInstance<Record<never, any> ... However, it looks like it's not recognizing the data properties ("object, ...
Read more >
[solved]-vue 3 ts 2339 : the property yyy doesn't exist ont type
Coding example for the question VUE 3 TS 2339 : The property xxx doesn't exist ont type {-Vue.js.
Read more >
Getting Property 'x' does not exist on type .... .Vetur(2339) #1834
adding properties inside a component breaks the known data and computed props and says Property 'x' does not exist on type 'CombinedVueInstance<Vue, object, ......
Read more >
FAQ | Vetur - GitHub Pages
If you are getting a lot of Property 'xxx' does not exist on type 'CombinedVueInstance' errors, it's an issue with Vue's typing and...
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