Repository navigation
[bpk-component-flare] Migrate to TypeScript - #4761
Conversation
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
There was a problem hiding this comment.
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-typeswith TypeScriptPropstype definitions forBpkFlareBarandBpkContentBubble. - Moves defaults into parameter destructuring and removes
propTypesblocks. - 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.
|
Visit https://backpack.github.io/storybook-prs/4761 to see this build running in a browser. |
|
Visit https://backpack.github.io/storybook-prs/4761 to see this build running in a browser. |
…suppressions.md Replace @ts-ignore with @ts-expect-error for untyped imports. Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
|
Visit https://backpack.github.io/storybook-prs/4761 to see this build running in a browser. |
…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]>
|
Visit https://backpack.github.io/storybook-prs/4761 to see this build running in a browser. |
|
Visit https://backpack.github.io/storybook-prs/4761 to see this build running in a browser. |
| export type Props = Omit<NativeDivProps, 'className'> & { | ||
| className?: string | null; | ||
| svgClassName?: string | null; | ||
| rounded?: boolean; |
There was a problem hiding this comment.
BpkFlareBar doesn't actually use rounded — it's not destructured, so it just gets spread onto the
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
Visit https://backpack.github.io/storybook-prs/4761 to see this build running in a browser. |
|
Visit https://backpack.github.io/storybook-prs/4761 to see this build running in a browser. |
| showPointer?: boolean; | ||
| className?: string | null; | ||
| contentClassName?: string | null; | ||
| flareProps?: (HTMLAttributes<HTMLDivElement> & { svgClassName?: string }) | null; |
There was a problem hiding this comment.
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;
There was a problem hiding this comment.
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.
|
Visit https://backpack.github.io/storybook-prs/4761 to see this build running in a browser. |
Summary
bpk-component-flarefrom JavaScript to TypeScriptprop-typeswith TypeScript interfacesdefaultPropsto ES6 destructure defaults.jssource/test/story files to.tsx/.tsCloses #4748