Skip to content

Conversation

@gert-janvercauteren

Summary

  • Migrates bpk-component-barchart from JavaScript to TypeScript
  • Updates bpk-component-datatable TypeScript types and snapshots

Changes

  • Rename .js files to .tsx
  • Add TypeScript type annotations
  • Update test files and snapshots

Test plan

  • Run npm run typecheck to verify TypeScript compilation
  • Run npm test -- --testPathPattern="bpk-component-barchart|bpk-component-datatable" to verify tests pass

🤖 Generated with Claude Code

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]>
Copilot AI review requested due to automatic review settings February 4, 2026 04:59
Copy link
Contributor

Copilot AI left a 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]>
@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/4206 to see this build running in a browser.

@skyscanner-backpack-bot
Copy link

skyscanner-backpack-bot bot commented Feb 4, 2026

Browser support

If this is a visual change, make sure you've tested it in multiple browsers.

Generated by 🚫 dangerJS against ad9985f

… 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]>
@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/4206 to see this build running in a browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants