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.

Prop types not showing correctly in template when using different casing in template and defineProps?

See original GitHub issue

Not sure if it’s just me, but I have this issue where if I define a prop with camelCase, and then I assign a value in the template of the parent component using kebab-case, hovering over the attribute will show the type of my input instead of the type of the actual prop. Using camelCase instead will show the correct typing on hover.

Child Component (tried using type declaration, runtime declaration and non script setup method with defineComponent) image

Parent Component: image image image

On v0.31.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
johnsoncodehkcommented, Oct 17, 2022

Now we show both casing hover info. 螢幕截圖 2022-10-18 04 55 21

For go further use case you can setting vueCompilerOptions.strictTemplates = true, it only allow define prop as camelCase so that avoid this problem. 螢幕截圖 2022-10-18 04 59 12

1reaction
johnsoncodehkcommented, Sep 21, 2022

@jacobprudhomme unfortunately snake_case is currently intentionally not supported, because it will makes type computation and codegen more complicate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Props typing in Vue.js 3 with TypeScript - Stack Overflow
1. What about if props type is array? · 2. @FarhodNematov it should be type: Array as PropType<FlashInterface[]>, or type: Array as PropType< ......
Read more >
Defining Props in React Function Component with Typescript
This guide will provide you with the syntax you need to properly define the props entering your components, compare and contrast defining ...
Read more >
How to Use Props in Vue.js - freeCodeCamp
We use props to pass information/data from a parent component to child components. In this article, I will explain everything you need to ......
Read more >
TypeScript with Composition API - Vue.js
In this case, our second example compiles into the exact same runtime options as the first ... We can also move the props...
Read more >
Typechecking With PropTypes - React
In this example, we're using PropTypes.string . When an invalid value is provided for a prop, a warning will be shown in the...
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