-
Notifications
You must be signed in to change notification settings - Fork 202
chore: TypeScript migration - Calendar & Date Components #4207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,17 +16,18 @@ | |
| * limitations under the License. | ||
| */ | ||
|
|
||
| /* @flow strict */ | ||
|
|
||
|
|
||
| import type { ReactNode } from 'react'; | ||
|
|
||
| import { render } from '@testing-library/react'; | ||
|
|
||
| import BpkIconMarker from './BpkIconMarker'; | ||
|
|
||
| jest.mock('@react-google-maps/api', () => ({ | ||
| OverlayView: (props) => ( | ||
| OverlayView: (props: { children: ReactNode }) => ( | ||
| <div> | ||
| <div className="mock-overlay-view" /> | ||
| {/* eslint-disable-next-line react/prop-types */} | ||
| {props.children} | ||
| </div> | ||
| ), | ||
|
|
@@ -69,7 +70,7 @@ describe('BpkIconMarker', () => { | |
| <BpkIconMarker | ||
| position={position} | ||
| icon={icon} | ||
| buttonProps={{ testId: 'arbitrary value' }} | ||
| buttonProps={{ 'data-testid': 'arbitrary value' }} | ||
|
||
| />, | ||
| ); | ||
| expect(asFragment()).toMatchSnapshot(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -16,28 +16,30 @@ | |||||
| * limitations under the License. | ||||||
| */ | ||||||
|
|
||||||
| /* @flow strict */ | ||||||
|
|
||||||
| import PropTypes from 'prop-types'; | ||||||
| import type { Node } from 'react'; | ||||||
| import type { ReactNode, MouseEvent, ButtonHTMLAttributes } from 'react'; | ||||||
|
|
||||||
|
|
||||||
| import { cssModules } from '../../bpk-react-utils'; | ||||||
|
|
||||||
| import BpkBasicMapMarker from './BpkBasicMapMarker'; | ||||||
| import BpkIconMarkerBackground from './BpkIconMarkerBackground'; | ||||||
| import { LatLongPropType, type LatLong } from './common-types'; | ||||||
| import { LatLongPropType } from './common-types'; | ||||||
|
|
||||||
| import type { LatLong } from './common-types'; | ||||||
|
|
||||||
| import STYLES from './BpkIconMarker.module.scss'; | ||||||
|
|
||||||
| const getClassName = cssModules(STYLES); | ||||||
|
|
||||||
| export type Props = { | ||||||
| icon: Node, | ||||||
| position: LatLong, | ||||||
| selected: boolean, | ||||||
| className: ?string, | ||||||
| onClick: ?(event: SyntheticEvent<>) => mixed, | ||||||
| buttonProps: ?{ [string]: any }, | ||||||
| type Props = { | ||||||
| icon: ReactNode; | ||||||
| position: LatLong; | ||||||
| className?: string | null; | ||||||
| onClick?: ((event: MouseEvent<HTMLButtonElement>) => void) | null; | ||||||
| selected?: boolean; | ||||||
| buttonProps?: (ButtonHTMLAttributes<HTMLButtonElement> & { [key: `data-${string}`]: string }) | null; | ||||||
| [key: string]: unknown; | ||||||
| }; | ||||||
|
|
||||||
| const BpkIconMarker = (props: Props) => { | ||||||
|
|
@@ -63,7 +65,7 @@ const BpkIconMarker = (props: Props) => { | |||||
| <button | ||||||
| type="button" | ||||||
| className={wrapperClassNames} | ||||||
| onClick={onClick} | ||||||
| onClick={onClick ?? undefined} | ||||||
|
||||||
| onClick={onClick ?? undefined} | |
| onClick={onClick} |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -16,64 +16,58 @@ | |||||
| * limitations under the License. | ||||||
| */ | ||||||
|
|
||||||
| /* @flow strict */ | ||||||
|
|
||||||
|
|
||||||
| import PropTypes from 'prop-types'; | ||||||
| import type { Node } from 'react'; | ||||||
| import { useCallback, useRef } from 'react'; | ||||||
|
|
||||||
| import { GoogleMap } from '@react-google-maps/api'; | ||||||
|
|
||||||
| import { cssModules } from '../../bpk-react-utils'; | ||||||
|
|
||||||
| import { LatLongPropType, type LatLong } from './common-types'; | ||||||
| import { LatLongPropType, } from './common-types'; | ||||||
|
||||||
| import { LatLongPropType, } from './common-types'; | |
| import { LatLongPropType } from './common-types'; |
Copilot
AI
Feb 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The LatLong type is being duplicated here when it should be imported from './common-types' instead. Remove this local definition and import the type from the common-types module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The import statement is split across two lines unnecessarily. Keep the import on a single line for better readability.