-
Notifications
You must be signed in to change notification settings - Fork 202
chore: TypeScript migration - Charts & Data Visualization #4206
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: main
Are you sure you want to change the base?
chore: TypeScript migration - Charts & Data Visualization #4206
Conversation
Migrates the following packages from JavaScript to TypeScript: - bpk-component-barchart - bpk-component-datatable Changes include: - Rename .js files to .tsx - Add TypeScript type annotations - Update test files and snapshots Co-Authored-By: Claude Opus 4.5 <[email protected]>
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 bpk-component-barchart package from JavaScript with Flow types to TypeScript, and updates snapshot files for both bpk-component-barchart and bpk-component-datatable.
Changes:
- Removed Flow type annotations (
/* @flow strict */) and replaced with TypeScript type definitions - Converted type syntax from Flow (
:for properties) to TypeScript (;for type properties) - Added proper TypeScript types for complex objects, scales, and component props
Reviewed changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/bpk-component-datatable/src/snapshots/*.snap | Added blank line at beginning of snapshot files |
| packages/bpk-component-barchart/src/snapshots/*.snap | Added blank line at beginning of snapshot files |
| packages/bpk-component-barchart/src/utils.tsx | Migrated utility functions to TypeScript with proper type definitions |
| packages/bpk-component-barchart/src/*-test.tsx | Removed Flow annotations from test files |
| packages/bpk-component-barchart/src/*.tsx | Converted component files from Flow to TypeScript types |
| packages/bpk-component-barchart/src/BpkChartMargin-test.tsx | Updated spacing token from spacingSm to spacingIconText |
| packages/bpk-component-barchart/src/BpkBarchart-test.tsx | Changed getBarLabel return from null to empty string |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Replace custom d3-scale type definitions with official @types/d3-scale and @types/lodash.debounce packages. Updated component type definitions to use proper ScaleBand<string> and ScaleLinear<number, number> types with type guards to handle the union type safely. Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
Visit https://backpack.github.io/storybook-prs/4206 to see this build running in a browser. |
… any usage - Add shared types.ts with DataPoint, Margin, NumericMargin, Scale, BarComponentProps, and TickValueFn types - Replace `any` with proper d3-scale types (ScaleBand, ScaleLinear) - Remove `as any` casts by aligning type signatures - Replace non-null assertions with nullish coalescing defaults - Add isBandScale type guard for scale discrimination - Use Record<string, unknown> instead of Record<string, any> Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
Visit https://backpack.github.io/storybook-prs/4206 to see this build running in a browser. |
Summary
bpk-component-barchartfrom JavaScript to TypeScriptbpk-component-datatableTypeScript types and snapshotsChanges
.jsfiles to.tsxTest plan
npm run typecheckto verify TypeScript compilationnpm test -- --testPathPattern="bpk-component-barchart|bpk-component-datatable"to verify tests pass🤖 Generated with Claude Code