-
Notifications
You must be signed in to change notification settings - Fork 16.3k
chore(ts): Migrate Column.jsx to Column.tsx #36346
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
base: master
Are you sure you want to change the base?
Conversation
|
Bito Review Skipped - No Changes Detected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR migrates the Column dashboard component from JavaScript/JSX to TypeScript/TSX as part of the broader TypeScript standardization effort (SIP-36). The migration converts PropTypes to TypeScript interfaces, adds proper type annotations to callbacks and functions, and updates corresponding test files with appropriate type definitions.
Key changes:
- Replaced PropTypes with TypeScript type definitions for component props
- Added type annotations for callbacks (resize handlers, change handlers)
- Updated test files with proper TypeScript types for mocks and test props
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
NewColumn.tsx |
Converted from named function to arrow function with FC type, added FC import |
NewColumn.test.tsx |
Added TypeScript types to mock component parameters |
Column/index.ts |
Simplified export statement to use inline default export |
Column.tsx |
Migrated from PropTypes to TypeScript type definitions, added proper callback types from re-resizable library, added heightMultiple prop to ResizableContainer |
Column.test.tsx |
Added TypeScript interfaces for test props, typed all mock implementations, updated attribute names from prop attributes to data attributes |
Comments suppressed due to low confidence (3)
superset-frontend/src/dashboard/components/gridComponents/Column/Column.test.tsx:226
- The test assertion references
columnWithoutChildren.meta.widthbut the test callssetup()with no arguments, which means it usesprops.component(i.e.,mockLayout.present.COLUMN_ID), notcolumnWithoutChildren. This test should either:
- Pass
{ component: columnWithoutChildren }to thesetup()call on line 224, OR - Change line 226 to check against
props.component.meta.widthinstead ofcolumnWithoutChildren.meta.width
Currently, the test happens to pass because both have the same width value (4), but this is misleading and could break if the fixture values change.
superset-frontend/src/dashboard/components/gridComponents/Column/Column.test.tsx:86
- [nitpick] The comment "or whatever number you expect" is vague and suggests uncertainty. Since this value is set to match
GRID_DEFAULT_CHART_WIDTH(which is 4), consider either removing the comment entirely or making it more specific, such as:width: 4, // GRID_DEFAULT_CHART_WIDTH
superset-frontend/src/dashboard/components/gridComponents/Column/Column.tsx:47 - Duplicate import of
FCfrom 'react'.FCis imported on line 47 but should be included in the destructured import from 'react' on lines 19-26 instead. Remove the duplicate import on line 47 and addFCto the first import statement.
|
@danawan0409 looks like there are a few errors, you might want to run |
SUMMARY
To migrate the Column component, the following steps were performed:
index.js⇒index.tsColumn.jsx⇒Column.tsxColumn.tsx:propTypesconstant with an type ColumnProps`Column.test.jsx⇒Column.test.tsxColumn.test.tsx:ColumnTestPropsmirroringColumnPropsfromColumn.tsxNewColumn.jsx⇒NewColumn.tsxNewColumn.test.jsx⇒NewColumn.test.tsxTESTING INSTRUCTIONS
CI and unit tests. Add a Column layout element to a dashboard and confirm that it renders as expected.
ADDITIONAL INFORMATION
REVIEWERS
@rusackas @msyavuz @justinpark @sadpandajoe @geido