Skip to content
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

Geocode types are fouled up #366

Open
steveoh opened this issue Nov 13, 2024 · 0 comments
Open

Geocode types are fouled up #366

steveoh opened this issue Nov 13, 2024 · 0 comments

Comments

@steveoh
Copy link
Member

steveoh commented Nov 13, 2024

Given

const geocodeOptions = {
    apiKey,
    wkid: config.WEB_MERCATOR_WKID,
    pointSymbol: {
      type: 'simple-marker',
      style: 'diamond',
      color: config.MARKER_FILL_COLOR,
      size: 20,
      outline: {
        color: config.MARKER_OUTLINE_COLOR,
        width: 3,
      },
    },
    events: {
      success: (event: Graphic) => {
        logEvent('findAddress::success', { ...event.attributes });

        const graphic = new Graphic(event);
        const point = new Viewpoint({ scale: 1500, targetGeometry: event.geometry });

        zoom(point);
        placeGraphic(graphic);

        mapView!.openPopup({
          features: [graphic],
          fetchFeatures: true,
          location: graphic.geometry as Point,
        });
      },
      error: () => {
        logEvent('findAddress::not found');
        placeGraphic(null);
      },
    },
  };

and

<Geocode {...geocodeOptions} />

tsc throws that a lot of props are missing

src/App.tsx:223:20 - error TS2739: Type '{ apiKey: any; wkid: number; pointSymbol: { type: string; style: string; color: number[]; size: number; outline: { color: number[]; width: number; }; }; events: { success: (event: Graphic) => void; error: () => void; }; }' is missing the following properties from type 'GeocodeProps': type, address, milepost, callback, format

223                   <Geocode {...geocodeOptions} />
                       ~~~~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant