Skip to content
New issue

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

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

Already on GitHub? # to your account

Augmenting ComponentCustomOptions with a function causes TS2769 when using augmention #13009

Open
6XGate opened this issue Apr 25, 2023 · 2 comments

Comments

@6XGate
Copy link

6XGate commented Apr 25, 2023

Version

2.7.14

Reproduction link

github.com

Steps to reproduce

  1. Augment the ComponentCustomOptions interface with a new optional member function. Example: funcOption?: (...) => ....
  2. Use the new member function in defineComponent. Example defineComponent({ name: 'CompName', funcOption: (...) => ... }).
  3. Run a build with type-checking. Example: npm run build with vite and vue-tsc installed and setup.

Using the repro link:

  1. Clone the repo
  2. Run npm ci
  3. Run npm run build

What is expected?

That the build would succeed without error.

What is actually happening?

A TS2769 error results when built. It seems TypeScript is attempting to use the functional component overload rather than one of the normal overloads.

@6XGate
Copy link
Author

6XGate commented Apr 25, 2023

Just discovered the same issue with augment ComponentOptions as well.

@rudyxu1102
Copy link

It will work if you change the return value of the funcOption.

const HomeView = defineComponent({
  name: 'HomeView',
  components: { TheWelcome },
  funcOption: route => {
    return {}
  }
})

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

No branches or pull requests

2 participants