reearth / resium

React components for 🌏 Cesium
https://resium.reearth.io
MIT License
747 stars 135 forks source link

`imageryProvider` prop on `Viewer` is typed incorrectly #673

Open MatthewHerbst opened 2 months ago

MatthewHerbst commented 2 months ago

Specs:

Expected: imageryProvider prop has no type errors Actual: imageryProvider prop is not recognized

This was typed correctly in Resium 1.14.3 (we recently upgraded to 1.18.2)

import { Viewer } from "resium";

import { defaultImageryProvider } from "./defaultImageryProvider";

function MyMap() {
  return (
          <Viewer
            ...
            imageryProvider={defaultImageryProvider}
            ...
        >
            ...
        </ResiumViewer>
  );
}

The type error we get is:

⚠ Error (TS2322)

Type:
{
  children: Element[];
  animation: false;
  baseLayerPicker: false;
  className: string;
  fullscreenButton: false;
  geocoder: false;
  globe: Globe;
  homeButton: false;
  imageryProvider: TileCoordinatesImageryProvider;
  infoBox: false;
  navigationHelpButton: false;
  requestRenderMode: true;
  scene3DOnly: true;
  sceneModePicker: false;
  selectionIndicator: false;
  style: { cursor: string };
  targetFrameRate: number;
  terrainProvider: TerrainProvider;
  timeline: false;
}
is not assignable to type:
IntrinsicAttributes & {} & {
  terrainShadows?: ShadowMode | undefined;
  clockTrackedDataSource?: DataSource | undefined;
  targetFrameRate?: number | undefined;
  useDefaultRenderLoop?: boolean | undefined;
  resolutionScale?: number | undefined;
  allowDataSourcesToSuspendAnimation?: boolean | undefined;
  trackedEntity?: Entity | undefined;
  selectedEntity?: Entity | undefined;
  shadows?: boolean | undefined;
  useBrowserRecommendedResolution?: boolean | undefined;
  creditDisplay?: unknown;
} & {} & {
  selectionIndicator?: boolean | undefined;
  infoBox?: boolean | undefined;
  geocoder?: boolean | GeocoderService[] | undefined;
  homeButton?: boolean | undefined;
  sceneModePicker?: boolean | undefined;
  projectionPicker?: boolean | undefined;
  baseLayerPicker?: boolean | undefined;
  navigationHelpButton?: boolean | undefined;
  animation?: boolean | undefined;
  timeline?: boolean | undefined;
  fullscreenButton?: boolean | undefined;
  vrButton?: boolean | undefined;
  dataSources?: DataSourceCollection | undefined;
  clockViewModel?: ClockViewModel | undefined;
  navigationInstructionsInitiallyVisible?: boolean | undefined;
  scene3DOnly?: boolean | undefined;
  shouldAnimate?: boolean | undefined;
  selectedImageryProviderViewModel?: ProviderViewModel | undefined;
  imageryProviderViewModels?: ProviderViewModel[] | undefined;
  selectedTerrainProviderViewModel?: ProviderViewModel | undefined;
  terrainProviderViewModels?: ProviderViewModel[] | undefined;
  skyBox?: false | SkyBox | undefined;
  skyAtmosphere?: false | SkyAtmosphere | undefined;
  fullscreenElement?: string | Element | undefined;
  showRenderLoopErrors?: boolean | undefined;
  automaticallyTrackDataSourceClocks?: boolean | undefined;
  contextOptions?: any;
  sceneMode?: SceneMode | undefined;
  mapProjection?: MapProjection | undefined;
  globe?: false | Globe | undefined;
  orderIndependentTranslucency?: boolean | undefined;
  creditContainer?: string | Element | undefined;
  creditViewport?: string | Element | undefined;
  mapMode2D?: MapMode2D | undefined;
  requestRenderMode?: boolean | undefined;
  maximumRenderTimeChange?: number | undefined;
  depthPlaneEllipsoidOffset?: number | undefined;
  msaaSamples?: number | undefined;
  baseLayer?: unknown;
  blurActiveElementOnCanvasFocus?: unknown;
  terrain?: unknown;
} & ViewerCesiumEvents &
  EventProps<RootEventTarget> & {
  onWheel?: ((delta: number) => void) | undefined;
} & RootComponentInternalProps & {
  className?: string | undefined;
  id?: string | undefined;
  style?: CSSProperties | undefined;
  full?: boolean | undefined;
  containerProps?: any;
  extend?: ViewerMixin | ViewerMixin[] | undefined;
  children?: ReactNode;
  terrainProvider?: TerrainProvider | Promise<TerrainProvider> | undefined;
} & RefAttributes<CesiumComponentRef<Viewer>>
.
  | Property imageryProvider does not exist on type:IntrinsicAttributes & {} & { terrainShadows?: ShadowMode \| undefined; clockTrackedDataSource?: DataSource \| undefined; targetFrameRate?: number \| undefined; useDefaultRenderLoop?: boolean \| undefined; resolutionScale?: number \| undefined; allowDataSourcesToSuspendAnimation?: boolean \| undefined; trackedEntity?: Entity \| undefined; selectedEntity?: Entity \| undefined; shadows?: boolean \| undefined; useBrowserRecommendedResolution?: boolean \| undefined; creditDisplay?: unknown; } & {} & { selectionIndicator?: boolean \| undefined; infoBox?: boolean \| undefined; geocoder?: boolean \| GeocoderService[] \| undefined; homeButton?: boolean \| undefined; sceneModePicker?: boolean \| undefined; projectionPicker?: boolean \| undefined; baseLayerPicker?: boolean \| undefined; navigationHelpButton?: boolean \| undefined; animation?: boolean \| undefined; timeline?: boolean \| undefined; fullscreenButton?: boolean \| undefined; vrButton?: boolean \| undefined; dataSources?: DataSourceCollection \| undefined; clockViewModel?: ClockViewModel \| undefined; navigationInstructionsInitiallyVisible?: \| boolean \| undefined; scene3DOnly?: boolean \| undefined; shouldAnimate?: boolean \| undefined; selectedImageryProviderViewModel?: \| ProviderViewModel \| undefined; imageryProviderViewModels?: \| ProviderViewModel[] \| undefined; selectedTerrainProviderViewModel?: \| ProviderViewModel \| undefined; terrainProviderViewModels?: \| ProviderViewModel[] \| undefined; skyBox?: false \| SkyBox \| undefined; skyAtmosphere?: false \| SkyAtmosphere \| undefined; fullscreenElement?: string \| Element \| undefined; showRenderLoopErrors?: boolean \| undefined; automaticallyTrackDataSourceClocks?: boolean \| undefined; contextOptions?: any; sceneMode?: SceneMode \| undefined; mapProjection?: MapProjection \| undefined; globe?: false \| Globe \| undefined; orderIndependentTranslucency?: boolean \| undefined; creditContainer?: string \| Element \| undefined; creditViewport?: string \| Element \| undefined; mapMode2D?: MapMode2D \| undefined; requestRenderMode?: boolean \| undefined; maximumRenderTimeChange?: number \| undefined; depthPlaneEllipsoidOffset?: number \| undefined; msaaSamples?: number \| undefined; baseLayer?: unknown; blurActiveElementOnCanvasFocus?: unknown; terrain?: unknown; } & ViewerCesiumEvents & EventProps & { onWheel?: ((delta: number) => void) \| undefined; } & RootComponentInternalProps & { className?: string \| undefined; id?: string \| undefined; style?: CSSProperties \| undefined; full?: boolean \| undefined; containerProps?: any; extend?: ViewerMixin \| ViewerMixin[] \| undefined; children?: ReactNode; terrainProvider?: \| TerrainProvider \| Promise \| undefined; } & RefAttributes> . -- | --
(property) imageryProvider: TileCoordinatesImageryProvider