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

ViewStateProps Typescript object has missing type options for zoom #8465

Open
1 of 7 tasks
alexjbuck opened this issue Feb 1, 2024 · 0 comments
Open
1 of 7 tasks
Labels

Comments

@alexjbuck
Copy link

alexjbuck commented Feb 1, 2024

Description

If your View is an Orthographic View then the zoom can be a [number,number] type to denote independent x and y zoom values. In practice this works, however the ViewStateProps type is defined with zoom?: number so ts throws an type-checking error if you defined zoom = [1,1] for example, in a ViewStateProps object.

Type 'number[]' is not assignable to type 'number'

Minimal example to be used with an OrthographicView:

  const [viewState, setViewState] = useState<ViewStateProps>({
    maxZoom: 4,
    minZoom: -4,
    target: [0, 0],
    zoom: [0, 0],
  });

Flavors

  • Script tag
  • React
  • Python/Jupyter notebook
  • MapboxOverlay
  • GoogleMapsOverlay
  • CartoLayer
  • ArcGIS

Expected Behavior

I expect to be able to provide either number or number[] to the zoom prop in a ViewStateProps object.

Steps to Reproduce

Minimal example to be used with an OrthographicView:

import { ViewStateProps } from "@deck.gl/core/lib/deck";

  const [viewState, setViewState] = useState<ViewStateProps>({
    maxZoom: 4,
    minZoom: -4,
    target: [0, 0],
    zoom: [0, 0],
  });

Environment

  • Framework version: "@deck.gl/core": "8.9.32",
  • Browser: Google Chrome
  • OS: MacOS 14.2.1
  • Editor: VS Code
  • Typescript 5.2.2

Logs

No response

@alexjbuck alexjbuck added the bug label Feb 1, 2024
@alexjbuck alexjbuck changed the title InitialViewStateProps Typescript object has missing type options for zoom ViewStateProps Typescript object has missing type options for zoom Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant