Skip to content

chore: TypeScript migration - Maps#4208

Open
Gert-Jan Vercauteren (gert-janvercauteren) wants to merge 2 commits intomainfrom
tsx-migration/maps
Open

chore: TypeScript migration - Maps#4208
Gert-Jan Vercauteren (gert-janvercauteren) wants to merge 2 commits intomainfrom
tsx-migration/maps

Conversation

@gert-janvercauteren

Summary

  • Migrates bpk-component-map from JavaScript to TypeScript

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-map" to verify tests pass

🤖 Generated with Claude Code

Migrates bpk-component-map from JavaScript to TypeScript.

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-map package from JavaScript with Flow type annotations to TypeScript.

Changes:

  • Removed Flow type comments (/* @flow strict */) and replaced Flow types with TypeScript equivalents
  • Renamed type definitions (e.g., type Props to interface definitions, Flow object syntax to TypeScript syntax)
  • Updated import/export statements to use TypeScript type syntax
  • Added type annotations for React types (ReactNode, ComponentType, etc.)
  • Updated test files to remove Flow-specific comments and add TypeScript types

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
withGoogleMapsScript.tsx Added TypeScript types for HOC props and library definitions
themeAttributes.tsx Removed Flow comment (whitespace-only change)
themeAttributes-test.tsx Removed Flow comment (whitespace-only change)
common-types.tsx Converted Flow types to TypeScript syntax
BpkPriceMarker-test.tsx.snap Added blank line at start of snapshot
BpkIconMarkerBackground-test.tsx.snap Added blank line at start of snapshot
BpkIconMarker-test.tsx.snap Added blank line at start of snapshot
BpkBasicMapMarker-test.tsx.snap Added blank line at start of snapshot
DefaultLoadingElement.tsx Removed Flow comment
BpkOverlayView.tsx Converted Flow types to TypeScript, redefined LatLong type locally
BpkMap.tsx Converted Flow types to TypeScript with extensive type definitions
BpkIconMarkerBackground.tsx Converted Props type to interface extending SVGProps
BpkIconMarkerBackground-test.tsx Removed Flow comment
BpkIconMarker.tsx Converted Flow types to TypeScript, updated event handler types
BpkIconMarker-test.tsx Added TypeScript types for mock, changed test prop to use data attribute
BpkBasicMapMarker.tsx Converted Flow types to TypeScript, removed ts-expect-error comments
BpkBasicMapMarker-test.tsx Added TypeScript types for mock
index.tsx Removed Flow comment and type exports

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

Comment on lines +27 to +30
type LatLong = {
latitude: number;
longitude: number;
};
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LatLong type is duplicated here but is already defined and exported in common-types.tsx. Import the type from common-types.tsx instead of redefining it locally to maintain a single source of truth.

Copilot uses AI. Check for mistakes.
import { OverlayView } from '@react-google-maps/api';

import { LatLongPropType, type LatLong } from './common-types';
import { LatLongPropType, } from './common-types';
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the trailing comma after LatLongPropType in the import statement for consistency with typical import formatting.

Suggested change
import { LatLongPropType, } from './common-types';
import { LatLongPropType } from './common-types';

Copilot uses AI. Check for mistakes.
Comment on lines +38 to 41
type LatLong = {
latitude: number;
longitude: number;
};
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LatLong type is duplicated here but is already defined and exported in common-types.tsx. Import the type from common-types.tsx instead of redefining it locally to maintain a single source of truth.

Copilot uses AI. Check for mistakes.
Comment on lines +21 to +22
import BpkIconMarker
from './src/BpkIconMarker';
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import statement for BpkIconMarker has an unusual line break. Place the entire import on a single line for better readability: import BpkIconMarker from './src/BpkIconMarker';

Suggested change
import BpkIconMarker
from './src/BpkIconMarker';
import BpkIconMarker from './src/BpkIconMarker';

Copilot uses AI. Check for mistakes.
@skyscanner-backpack-bot
Copy link

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

@gert-janvercauteren
Copy link
Contributor Author

Copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Feb 5, 2026

Gert-Jan Vercauteren (@gert-janvercauteren) I've opened a new pull request, #4214, to work on those changes. Once the pull request is ready, I'll request review from you.

@skyscanner-backpack-bot
Copy link

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