Detect unknown/undefined prop usage
See original GitHub issueThis is a proposal for enhancing vue-tsc
Example:
<MyComponent
:propThatDoesNotExist="42"
/>
When running npx vue-tsc --noEmit i want it to detect that propThatDoesNotExist is not presently defined in myComponent. This could produce a warning or error.
Feature like this currently exists in TS files. When trying to edit fields that is not defined in some typescript class it will output: Property ‘xxx’ does not exist on type ‘MyClass’.
This would be very helpful for Vue developers when renaming props or performs refactoring or git rebases as looking through the code manually can be tedious.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:45 (16 by maintainers)
Top Results From Across the Web
Unknown Prop Warning - React
The unknown-prop warning will fire if you attempt to render a DOM element with a prop that is not recognized by React as...
Read more >Check if props are undefined when loading component
Save this question. Show activity on this post. I have a question regarding checking if props are undefined in a functional component in...
Read more >ReferenceError: reference to undefined property "x" - JavaScript
The JavaScript warning "reference to undefined property" occurs when a script attempted to access an object property which doesn't exist.
Read more >Documentation - Everyday Types - TypeScript
To specify the type of an array like [1, 2, 3] , you can use the syntax ... from an optional property, you'll...
Read more >useForm - watch - Simple React forms validation
Props ; string, Watch input value by name (similar to lodash get function) ; string[], Watch multiple inputs ; undefined, Watch all inputs...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This isn’t just about fallthrough either, as shown in https://github.com/johnsoncodehk/volar/issues/1383 this is causing errors for many completely standard HTML attributes directly on the elements. It seems unreasonable requiring people to add custom declaration files to avoid that
In 0.36, custom / unknown attrs types behavior handle responsibility will transfer to developer.