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

[Bug] Type error in @deck.gl/carto v9.0.0.alpha-7 #8431

Closed
1 of 7 tasks
srtena opened this issue Jan 18, 2024 · 0 comments
Closed
1 of 7 tasks

[Bug] Type error in @deck.gl/carto v9.0.0.alpha-7 #8431

srtena opened this issue Jan 18, 2024 · 0 comments
Assignees
Labels
Milestone

Comments

@srtena
Copy link
Collaborator

srtena commented Jan 18, 2024

Description

I was migrating an example application running in v8 of both @deck.gl and @deck.gl/carto to the v9 alpha counterparts, following the current documentation and specs.

This is the basic code powering the application layers:

const pois = vectorQuerySource({
  ...cartoConfig,
  sqlQuery: 'SELECT * FROM carto-demo-data.demo_tables.osm_pois_usa'
});
new VectorTileLayer({
      id: 'pois',
      data: pois,
      ...
    }),

The issue is that the resulting Typescript code can't be compiled into a build version due to the following type error on the data attribute:

Type 'Promise<TilejsonResult>' is not assignable to type '((TilejsonResult | Promise<TilejsonResult> | null) & Promise<TilejsonResult> & URLTemplate) | undefined'.
  Type 'Promise<TilejsonResult>' is not assignable to type 'Tilejson & { accessToken: string; } & Promise<TilejsonResult> & string[]'.
    Type 'Promise<TilejsonResult>' is missing the following properties from type 'Tilejson': tilejson, name, description, version, and 12 more.ts(2322)
vector-tile-layer.d.ts(9, 5): The expected type comes from property 'data' which is declared here on type 'Partial<Required<_MVTLayerProps> & Required<_VectorTileLayerProps> & { id: "pois"; data: Promise<TilejsonResult>; ... 8 more ...; updateTriggers: { ...; }; } & Required<...> & Required<...> & Required<...>>'

After showing the to @felixpalmer we agreed it looks like a bug around types and that we'd like to double-check it, so I'm opening this issue and hoping for a fix :)

Flavors

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

Expected Behavior

Types should work just fine passing promises to the data attribute

Steps to Reproduce

Here's a Stackblitz project to reproduce the issue: https://stackblitz.com/edit/vitejs-vite-1jnk4p?file=src%2Fmap.ts

Environment

  • Framework version: deck.gl@9.0.0-alpha.7
  • Browser: N/A
  • OS: macOS 13.0

Logs

No response

@srtena srtena added the bug label Jan 18, 2024
@felixpalmer felixpalmer self-assigned this Jan 18, 2024
@felixpalmer felixpalmer added this to the v9.0 milestone Jan 18, 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

2 participants