-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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
[Bug Report][3.4.7] VDataTable - headers prop typescript error #18901
Comments
Same issue here!! the property works but with red error line in |
same issue.. |
I've found a "solution", just give a type
|
A better workaround solution would be to type it |
|
To help others understand how to use this (as I wasn't sure at first either). const headers = ref([
{ title: 'Plant', align: 'start', sortable: false, key: 'name' },
{ title: 'Light', align: 'end', key: 'light' },
{ title: 'Height', align: 'end', key: 'height' },
{ title: 'Pet Friendly', align: 'end', key: 'petFriendly' },
{ title: 'Price ($)', align: 'end', key: 'price' },
] as const) |
i think things like align and other props whos values are fixed set of string values, need to be declared as const. Alternatively, you can also declare typings like this
and set your header as those types. |
issue closed? why? important types are not exported yet. |
in my case, as |
Environment
Vuetify Version: 3.4.7
Vue Version: 3.3.12
Browsers: Chrome 120.0.0.0
OS: Mac OS 10.15.7
Steps to reproduce
Expected Behavior
Should not error
Actual Behavior
The
align
property of the headers array when added causes the error.Reproduction Link
https://play.vuetifyjs.com/#...
Other comments
As per @KaelWD it needs
as const
Example without
align
Error
The text was updated successfully, but these errors were encountered: