Unexpected TS problem with q-table
See original GitHub issueWhat happened?
Creating a project from scratch with the quasar CLI and adding:
<q-table :columns="cols"> </q-table>
</q-page>
const cols = ref([
{ label: 'hello', name: '123', field: '123', align: 'left' },
]);
The problem emerges in VS Code when I add the “align” field to the column data object:
Type '{ label: string; name: string; field: string; align: string; }[]' is not assignable to type '{ name: string; label: string; field: string | ((row: any) => any); required?: boolean; align?: "left" | "right" | "center"; sortable?: boolean; sort?: (a: any, b: any, rowA: any, rowB: any) => number; ... 5 more ...; headerClasses?: string; }[]'.
Type '{ label: string; name: string; field: string; align: string; }' is not assignable to type '{ name: string; label: string; field: string | ((row: any) => any); required?: boolean; align?: "left" | "right" | "center"; sortable?: boolean; sort?: (a: any, b: any, rowA: any, rowB: any) => number; ... 5 more ...; headerClasses?: string; }'.
This might be a Volar issue, I don’t know.
What did you expect to happen?
I expected no problems by adding the align
field
Reproduction URL
n/a
How to reproduce?
create an app with vite and typescript usning the quasar cli. then add a q-table: <q-table :columns="cols"> </q-table> and create a variable with the align property like this: const cols = ref([ { label: ‘hello’, name: ‘123’, field: ‘123’, align: ‘left’ }, ]);
Flavour
Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)
Areas
Quasar CLI Commands/Configuration (@quasar/cli | @quasar/app-webpack | @quasar/app-vite)
Platforms/Browsers
No response
Quasar info output
No response
Relevant log output
No response
Additional context
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Fundamental issue with Typescript - "[ts] Unexpected token. A ...
I tried to search for a solution but I can't find one. Simple Problem. It also happens when i write this: functionOne(); var...
Read more >When a QTable columns prop has the align set to 'left' or 'right ...
Explanation of the TS behavior. If you hover over columns in your definition, you will see that it shows align as string instead...
Read more >Qt Programming [Archive] - Page 11 - Qt Centre Forum
Problem with a combobox · adding items in qtablewidget · Database access from Qt · config file class · need help for tree...
Read more >Playing Pong Using Q-Learning
Before solving any decision problem using the MDP method, one must ... surprising result in Table 5 is TS 3 which uses the...
Read more >Untitled
· Adding checkBox as vertical header in QtableView . ... The latest version of Qt is 6.3.0 released on 12 April 2022.. Also...
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 FreeTop 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
Top GitHub Comments
solved it:
@yusufkandemir Thanks for your answer, but I don’t think it addresses this problem:
But why. ‘align’ is perfectly fine according to documentattion, and even type def files as far as I can see.