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

Empty props object causes unnecessary type error #3430

Closed
scottbedard opened this issue Jul 20, 2023 · 1 comment
Closed

Empty props object causes unnecessary type error #3430

scottbedard opened this issue Jul 20, 2023 · 1 comment
Labels
good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first upstream

Comments

@scottbedard
Copy link

Reproduction

Create a component with an empty props object,

export default defineComponent({
  props: {}
})

https://play.vuejs.org/#eNrFUj1PwzAQ/SuWl4JUkqFbCZUoqhAMgIDRS0iuwcWxLdspQVX+O2c7STtAYUFMuY/nu/cub0cvtU62DdA5zRzUWuQOFkwSkpV8GwIMl3lJUkz69FqpmGOcRliWHjzG1BaGa0dELqsLRp1lFOu81so4siMlrLmEK4W5BOlIR9ZG1WSCPCYjzC+N5STF2JPcNwOFoeuTvs0ktAGAK/JGhO/hqpOdZ10MqZ2TUCB+2zRGfpqPOia7U68salnQKeoolFzzKtlYJfFi4S2jfhwXYO6140qi1nEqo7kQ6v021JxpoN+Bb16hePuivrGtrzH6YMCC2QKjY8/lpgIX26unO2gxHpu1KhuB6CPNR7BKNJ5jhC0bWSLtA1xgexNOzGX1bFetA2kHUZ5ouEzAM4on94f9Tvqe7iyZDRfFK/Y/85jjEPI37jr/rUW0Udq7o5uSNCXZGUEC7iOWiXrZQOG8P3DeaBAmUdzgxWPqBof9ozzUJNVParpPcwBkWA==

Expected result

The component should render normally, and no type errors should occur

Actual result

The following error is thrown

Argument of type '{}' is not assignable to parameter of type '({ [x: number]: string; readonly length: unknown; readonly concat: unknown; readonly join: unknown; readonly slice: unknown; readonly indexOf: unknown; readonly lastIndexOf: unknown; readonly every: unknown; readonly some: unknown; readonly forEach: unknown; ... 28 more ...; onVnodeUnmounted?: VNodeMountHook | VNode...'.ts(2345)

Additional context

This is easy to side-step by simply removing the props object, but adds friction to things like resolving merge conflicts and component refactoring.

@so1ve
Copy link
Member

so1ve commented Jul 21, 2023

Thanks, this is a vue core issue. vuejs/core#8825

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good reproduction ✨ This issue provides a good reproduction, we will be able to investigate it first upstream
Projects
None yet
Development

No branches or pull requests

3 participants