Skip to content

[BpkComponents] Convert components to TSX#4205

Open
Gert-Jan Vercauteren (gert-janvercauteren) wants to merge 13 commits intomainfrom
gert-janvercauteren/tsx-single
Open

[BpkComponents] Convert components to TSX#4205
Gert-Jan Vercauteren (gert-janvercauteren) wants to merge 13 commits intomainfrom
gert-janvercauteren/tsx-single

Conversation

@gert-janvercauteren

Convert component packages and Storybook examples from JS/Flow to TSX with TypeScript checks suppressed via // @ts-nocheck.
Add a minimal require type and relax noImplicitAny to keep the migration compiling.
Testing: Not run (not requested).

Remember to include the following changes:

  • Ensure the PR title includes the name of the component you are changing so it's clear in the release notes for consumers of the changes in the version e.g [Clover-123][BpkButton] Updating the colour
  • README.md (If you have created a new component)
  • Component README.md
  • Tests
  • Accessibility tests
    • The following checks were performed:
      • Ability to navigate using a keyboard only
      • Zoom functionality (Deque University explanation):
        • The page SHOULD be functional AND readable when only the text is magnified to 200% of its initial size
        • Pages must reflow as zoom increases up to 400% so that content continues to be presented in only one column i.e. Content MUST NOT require scrolling in two directions (both vertically and horizontally)
      • Ability to navigate using a screen reader only
  • Storybook examples created/updated
  • For breaking changes or deprecating components/properties, migration guides added to the description of the PR. If the guide has large changes, consider creating a new Markdown page inside the component's docs folder and link it here

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 converts component packages and Storybook examples from JavaScript/Flow to TypeScript (TSX) with type checking suppressed via // @ts-nocheck. This is an intermediate migration step that maintains compilation while preparing for full TypeScript adoption.

Changes:

  • Replaced Flow type annotations with // @ts-nocheck directive across all component files
  • Removed Flow-specific type definitions and imports
  • Updated package.json to include --maxWorkers=50% for Jest commands

Reviewed changes

Copilot reviewed 299 out of 1083 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/bpk-component-barchart/src/*.tsx Removed Flow types and added ts-nocheck to barchart components
packages/bpk-component-banner-alert/src/*.tsx Removed Flow types and added ts-nocheck to banner alert components
packages/bpk-component-badge/src/*.tsx Removed Flow types and added ts-nocheck to badge components
packages/bpk-component-autosuggest/src/*.tsx Removed Flow types and added ts-nocheck to autosuggest components
packages/bpk-component-aria-live/src/*.tsx Removed Flow types and added ts-nocheck to aria-live components
packages/bpk-component-accordion/src/*.tsx Removed Flow types and added ts-nocheck to accordion components
packages/bpk-animate-height/src/*.tsx Removed Flow types and added ts-nocheck to animate-height components
examples/**/*.tsx Removed Flow types and added ts-nocheck to all Storybook examples
package.json Added maxWorkers configuration to Jest commands for performance

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@skyscanner-backpack-bot
Copy link

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

@skyscanner-backpack-bot
Copy link

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

@skyscanner-backpack-bot
Copy link

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

@skyscanner-backpack-bot
Copy link

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

- Fix react/sort-comp errors by removing instance property declarations
- Fix react/prop-types errors by adding TypeScript interfaces
- Fix import/prefer-default-export by adding type export
- Fix no-undef errors by importing React types properly
- Replace React.* namespace references with direct imports
- Use ReturnType<typeof setTimeout> instead of NodeJS.Timeout
- Add proper Flow type imports for SyntheticEvent

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@skyscanner-backpack-bot
Copy link

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

- Remove unused useCallback import from BpkPriceRange
- Add eslint-disable comments for IntersectionObserverInit type (DOM type not recognized by ESLint)
- Add eslint-disable comment for globalThis in intersection-observer polyfill
- Add proper TypeScript types to DataSource.fetchItems parameters
- Add documentation to require.d.ts type declaration

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@skyscanner-backpack-bot
Copy link

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

Restore compile-time type safety that was lost during the JS to TSX
migration by adding proper TypeScript type annotations to:

- bpk-component-table: BpkTable, BpkTableRow, BpkTableBody, BpkTableHead,
  BpkTableCell, BpkTableHeadCell
- bpk-component-section-list: BpkSectionList, BpkSectionListItem,
  BpkSectionListSection
- bpk-component-barchart: BpkBarchartBar, BpkBarchartBars, BpkChartAxis,
  BpkChartDataTable, BpkChartGridLines, BpkChartMargin
- bpk-component-horizontal-nav: BpkHorizontalNav, BpkHorizontalNavItem
- bpk-component-map: BpkIconMarker

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@skyscanner-backpack-bot
Copy link

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

- Remove 26 unused @ts-expect-error directives that TypeScript no longer
  requires after the JS to TSX migration
- Add type declarations for external modules lacking types:
  - d3-scale
  - lodash.debounce
  - react-autosuggest

Co-Authored-By: Claude Opus 4.5 <[email protected]>
…functions

Add proper TypeScript interfaces and types to components that were migrated
from Flow. This includes Props/State interfaces for class components, typed
function parameters, and generic type parameters for HOCs and data structures.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add type annotations to component props and function parameters
- Fix implicit any types in test files and class components
- Replace spacingSm with spacingIconText (token renamed)
- Move propTypes/defaultProps inside class components for TS compatibility
- Add proper type assertions for DOM queries in tests
- Fix nullable property assignments with nullish coalescing

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@skyscanner-backpack-bot
Copy link

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

- Add type declarations for bpk-storybook-utils
- Fix null vs undefined mismatches in component props
- Add missing Props types to components
- Fix HOC type constraints and setState patterns
- Update test files with proper type assertions
- Add eslint-disable comments for react/sort-comp on class fields
- Remove unused @ts-expect-error directives
- Add 'as const' to SIZES/ALIGNS for proper literal types

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/4205 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant