Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to 2.7.5 - Property '$children' does not exist on type 'never'. #12655

Closed
2-5 opened this issue Jul 13, 2022 · 3 comments
Closed

Upgrade to 2.7.5 - Property '$children' does not exist on type 'never'. #12655

2-5 opened this issue Jul 13, 2022 · 3 comments

Comments

@2-5
Copy link

2-5 commented Jul 13, 2022

Version

2.7.5

Reproduction link

https://codesandbox.io/s/vue-typescript-example-forked-hvzpki?file=/src/main.ts

Steps to reproduce

import Vue from "vue"

import App from "./components/App.vue"

export const main = new Vue({
  el: "#app",
  render: (createElement) => createElement(App),
})

export function getContainerComponent() {
  return main.$root.$children[0].$children[0]
}

What is expected?

no typescript error

What is actually happening?

After upgrading from 2.7.4 to 2.7.5 the code above fails to compile:

ERROR in ./src/main.ts:12:21
TS2339: Property '$children' does not exist on type 'never'.
    10 |
    11 | export function getContainerComponent(): Vue {
  > 12 |   return main.$root.$children[0].$children[0]
       |                     ^^^^^^^^^
    13 | }
@pasteusernamehere
Copy link

Seeing a similar error when accessing $options: component?.$parent?.$options?.name. Compiled fine under 2.7.4.

@tschni
Copy link

tschni commented Jul 14, 2022

I have the same problem when I try to access this.$root

@JoergHeinicke5005
Copy link

Same here:
src/main/client/js/mixin/action/SentAction.ts:47:22 - error TS2339: Property '$emit' does not exist on type 'never'.
47 this.$root.$emit(EventType.PUBLISH_GLOBAL_EVENT, sendEvent);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants