ts-jest: TS: 2339: Property 'xxx' does not exist on type 'CombinedVueInstance>'

🐛 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

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16

Most upvoted comments