rusackas opened a new pull request, #44208:
URL: https://github.com/apache/superset/pull/44208

   ### SUMMARY
   Depends on #44186 — this branch stacks on top of it, so the diff below 
includes those commits until it merges and this one rebases.
   
   Follow-up to #44186's cleanup of `ListView/utils.ts`. `ListView.tsx` itself 
still had `any` all over `ListViewProps` (`columns`, `bulkActions`, 
`renderBulkSelectCopy`) plus a few inline `as any` casts for row selection.
   
   Fixing those exposed that `TableCollection`'s `columns` prop was declared as 
`ColumnInstance<T>[]` — a react-table type that only exists once `useTable()` 
has built its column tree — when what's actually passed everywhere (from 
`ListView.tsx`, and this package's own stories) is the raw column config array 
authors write by hand. This adds `ListViewColumn<T>` (in 
`packages/superset-ui-core/src/components/TableCollection/utils.tsx`) as a 
purpose-built type for that shape, rather than reusing react-table's own 
`Column<D>`: react-table requires a column's `accessor` to be either a specific 
`keyof D` literal or an accessor function, but every one of this codebase's ~20 
list pages writes `accessor` as a plain (TypeScript-widened) string. Matching 
react-table's stricter modeling would mean touching every one of those pages' 
column arrays, which is out of scope for this pass.
   
   Also fixes a real gap uncovered along the way: `packages/superset-ui-core` 
and the app are separate TypeScript project references, so the react-table 
declaration-merging augmentation added in #44186 
(`superset-frontend/src/types/react-table.d.ts`) isn't visible inside 
`superset-ui-core`'s own compilation. Adds a second, narrowly-scoped copy at 
`packages/superset-ui-core/types/react-table.d.ts` covering what that project 
actually uses (`TableView`'s `useTable()` call, `TableCollection` reading 
`isSorted`/`isSortedDesc` off `HeaderGroup`s). Along the way, deletes 
`packages/superset-ui-core/types/react-table-config.d.ts` — a pre-existing 
"kitchen sink" version of the same idea that was never actually effective: 
react-table's `Column` is a type alias, not an interface, so its `export 
interface Column<D> extends ... {}` augmentation could never merge with it.
   
   `ListView.tsx`'s ~20 consumer pages (`UsersList`, `ChartList`, etc.) still 
define their own columns without any type annotation at all — untouched here, 
and a much bigger lift given the `accessor`-typing gap above.
   
   ### TESTING INSTRUCTIONS
   - `npx tsc -b .` — clean (the handful of remaining errors on a full 
`--force` rebuild are the same pre-existing, unrelated declaration-emit quirks 
called out in #44186: `d3`/`echarts`/`.stories.tsx` files this PR doesn't touch)
   - 20 Jest suites covering `ListView`, `TableCollection`, `TableView`, and 
every consumer page whose columns config changed type — 255 tests, all passing
   - `pre-commit run` on the changed files — clean
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to