Skip to content
This repository was archived by the owner on Aug 5, 2026. It is now read-only.

[bpk-component-flare] Migrate to TypeScript - #4761

Merged
GC Zhu (gc-skyscanner) merged 12 commits into
mainfrom
ts-migration/bpk-component-flare
Jul 16, 2026
Merged

GC Zhu (gc-skyscanner) merged 12 commits into
mainfrom
ts-migration/bpk-component-flare

Conversation

@gert-janvercauteren

Copy link
Copy Markdown
Contributor

Summary

  • Migrates bpk-component-flare from JavaScript to TypeScript
  • Replaces prop-types with TypeScript interfaces
  • Converts defaultProps to ES6 destructure defaults
  • Removes Flow type annotations
  • Renames .js source/test/story files to .tsx/.ts

Closes #4748

Migrates bpk-component-flare from JavaScript to TypeScript as described in #4748.

- Replaced prop-types with TypeScript interfaces
- Converted defaultProps to ES6 destructure defaults
- Renamed .js source/test/story files to .tsx/.ts
- Removed Flow type annotations
- Preserved Apache 2.0 license headers

Closes #4748
Copilot AI review requested due to automatic review settings June 26, 2026 09:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.

Migrates bpk-component-flare component typing from runtime prop-types/Flow annotations toward TypeScript-style types and defaults.

Changes:

  • Replaces prop-types with TypeScript Props type definitions for BpkFlareBar and BpkContentBubble.
  • Moves defaults into parameter destructuring and removes propTypes blocks.
  • Removes Flow file directive from the package entrypoint.

Reviewed changes

Copilot reviewed 3 out of 6 changed files in this pull request and generated no comments.

File Description
packages/backpack-web/src/bpk-component-flare/src/BpkFlareBar.js Introduces TS-style Props typing and removes propTypes.
packages/backpack-web/src/bpk-component-flare/src/BpkContentBubble.js Introduces TS-style Props typing (including flareProps) and removes propTypes.
packages/backpack-web/src/bpk-component-flare/index.js Removes Flow pragma from entrypoint.

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

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@skyscanner-backpack-bot

skyscanner-backpack-bot Bot commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Browser support

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

Generated by 🚫 dangerJS against 5f55847

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

…suppressions.md

Replace @ts-ignore with @ts-expect-error for untyped imports.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

…suppression

- Fix @ts-expect-error placement in calendar/index.ts (precede the 'from' clause)
- Remove @ts-expect-error in BpkDialogInner: bpk-component-flare is now TypeScript
  on this branch so the suppression is no longer needed.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

export type Props = Omit<NativeDivProps, 'className'> & {
className?: string | null;
svgClassName?: string | null;
rounded?: boolean;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

BpkFlareBar doesn't actually use rounded — it's not destructured, so it just gets spread onto the

(L55). Passing rounded={true} would render an invalid rounded="true" DOM attribute.

It was never in the old propTypes either, so it's always been a no-op. Suggest removing it here, plus the "rounded set to false" test in BpkFlareBar-test.tsx (it passes only because the prop does nothing).

Same dead rounded also appears on flareProps in BpkContentBubble.tsx — worth removing together.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good catch — removed rounded from BpkFlareBar's Props and dropped the "rounded set to false" test in BpkFlareBar-test.tsx (plus its snapshot). Pushed in abb7241.

showPointer?: boolean;
className?: string | null;
contentClassName?: string | null;
flareProps?: (HTMLAttributes<HTMLDivElement> & { svgClassName?: string; rounded?: boolean }) | null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

flareProps gets spread onto BpkFlareBar (L108), but BpkFlareBar doesn't use rounded — so this rounded?: boolean is the same dead prop as the one on BpkFlareBar's type. If we drop it there, remove it here too, otherwise the type still advertises a prop that does nothing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Removed rounded from the flareProps type too, and updated the two BpkContentBubble-test.tsx cases that were passing flareProps={{ rounded: false }}. Pushed in abb7241.

BpkFlareBar never read rounded off its props (it fell into ...rest and
was spread onto the <div>), and it was never part of the pre-migration
propTypes. Drop it from BpkFlareBar's Props, from the flareProps type
on BpkContentBubble (which spreads into BpkFlareBar), and the test
that only passed because the prop was a no-op.
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

showPointer?: boolean;
className?: string | null;
contentClassName?: string | null;
flareProps?: (HTMLAttributes<HTMLDivElement> & { svgClassName?: string }) | null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

flareProps is spread directly onto <BpkFlareBar {...flareProps} />, so this inline type is essentially a manual copy of BpkFlareBar's props — and already out of sync (svgClassName: string here vs string | null there). Suggest reusing the exported type:

import BpkFlareBar, { type Props as BpkFlareBarProps } from './BpkFlareBar';

flareProps?: BpkFlareBarProps | null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good point — switched flareProps to reuse BpkFlareBar's exported Props type directly instead of the manual copy. Pushed in 5f55847.

flareProps is spread directly onto <BpkFlareBar>, so the inline type
was a manual, already-diverging copy (svgClassName was non-nullable
here vs nullable on BpkFlareBar). Import and reuse BpkFlareBar's
exported Props type instead.
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@gc-skyscanner GC Zhu (gc-skyscanner) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@gc-skyscanner
GC Zhu (gc-skyscanner) enabled auto-merge (squash) July 16, 2026 09:44
@gc-skyscanner
GC Zhu (gc-skyscanner) merged commit 834e12e into main Jul 16, 2026
14 of 15 checks passed
@gc-skyscanner
GC Zhu (gc-skyscanner) deleted the ts-migration/bpk-component-flare branch July 16, 2026 09:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

minor Non breaking change ts-conversion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bpk-component-flare] Migrate to TypeScript

5 participants