Skip to content

Commit

Permalink
docs: fix gmp-map-3d mode and types (#694)
Browse files Browse the repository at this point in the history
  • Loading branch information
usefulthink authored Feb 22, 2025
1 parent 396b7d3 commit d5f360d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions examples/map-3d/src/map-3d/map-3d-types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-namespace, @typescript-eslint/no-explicit-any */

import {DOMAttributes, RefAttributes} from 'react';

// add an overload signature for the useMapsLibrary hook, so typescript
Expand All @@ -8,10 +10,18 @@ declare module '@vis.gl/react-google-maps' {
): typeof google.maps.maps3d | null;
}

// temporary fix until @types/google.maps is updated with the latest changes
declare global {
namespace google.maps.maps3d {
interface Map3DElement extends HTMLElement {
mode?: 'HYBRID' | 'SATELLITE';
}
}
}

// add the <gmp-map-3d> custom-element to the JSX.IntrinsicElements
// interface, so it can be used in jsx
declare module 'react' {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace JSX {
interface IntrinsicElements {
['gmp-map-3d']: CustomElement<
Expand All @@ -29,7 +39,6 @@ type CustomElement<TElem, TAttr> = Partial<
RefAttributes<TElem> & {
// for whatever reason, anything else doesn't work as children
// of a custom element, so we allow `any` here
// eslint-disable-next-line @typescript-eslint/no-explicit-any
children: any;
}
>;
2 changes: 1 addition & 1 deletion examples/map-3d/src/map-3d/map-3d.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const Map3D = forwardRef(
heading={props.heading}
tilt={props.tilt}
roll={props.roll}
mode="hybrid"></gmp-map-3d>
mode="HYBRID"></gmp-map-3d>
);
}
);

0 comments on commit d5f360d

Please sign in to comment.