chore: TypeScript migration - Maps#4208
chore: TypeScript migration - Maps#4208Gert-Jan Vercauteren (gert-janvercauteren) wants to merge 2 commits intomainfrom
Conversation
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]>
There was a problem hiding this comment.
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 Propsto 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.
| type LatLong = { | ||
| latitude: number; | ||
| longitude: number; | ||
| }; |
There was a problem hiding this comment.
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.
| import { OverlayView } from '@react-google-maps/api'; | ||
|
|
||
| import { LatLongPropType, type LatLong } from './common-types'; | ||
| import { LatLongPropType, } from './common-types'; |
There was a problem hiding this comment.
Remove the trailing comma after LatLongPropType in the import statement for consistency with typical import formatting.
| import { LatLongPropType, } from './common-types'; | |
| import { LatLongPropType } from './common-types'; |
| type LatLong = { | ||
| latitude: number; | ||
| longitude: number; | ||
| }; |
There was a problem hiding this comment.
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.
| import BpkIconMarker | ||
| from './src/BpkIconMarker'; |
There was a problem hiding this comment.
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';
| import BpkIconMarker | |
| from './src/BpkIconMarker'; | |
| import BpkIconMarker from './src/BpkIconMarker'; |
|
Visit https://backpack.github.io/storybook-prs/4208 to see this build running in a browser. |
Co-authored-by: Copilot <[email protected]>
|
Copilot open a new pull request to apply changes based on the comments in this thread |
|
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. |
|
Visit https://backpack.github.io/storybook-prs/4208 to see this build running in a browser. |
Summary
bpk-component-mapfrom JavaScript to TypeScriptChanges
.jsfiles to.tsxTest plan
npm run typecheckto verify TypeScript compilationnpm test -- --testPathPattern="bpk-component-map"to verify tests pass🤖 Generated with Claude Code