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

Please provide a sample for "Implement a layer from scratch" #197

Open
ghost opened this issue Jun 14, 2021 · 0 comments
Open

Please provide a sample for "Implement a layer from scratch" #197

ghost opened this issue Jun 14, 2021 · 0 comments

Comments

@ghost
Copy link

ghost commented Jun 14, 2021

This simple bit of code from the deck.gl docs won't work when copied naively:

  • "Error: TS2707: Generic type 'Layer<D, P>' requires between 1 and 2 type arguments." leads to:
    • this.context not found
    • this.setState not found
    • this.props not found

Looking at the existing typings, it looks like I need something convoluted like:

export interface CubeLayerProps<D> extends LayerProps<D> {
  image: any;
}
export default class CubeLayer<D, P extends CubeLayerProps<D> = CubeLayerProps<D>> extends Layer<D, P> {

However, then I still get problems with another sample for defining custom uniforms, because what I pass into super.draw({uniforms: [...]} is incomplete; it requires the optional fields (parameters, context, moduleParameters) to be set.

I'm not sure if these are bugs in the typings or wether these are expected changes (while I expect some change to add types, this convoluted style to define the new layer looks like bad design).
Figuring this out on my own took longer than it should have taken.
There should be a sample to guide users in the right direction, and to assure them that they are using the deck.gl as intended in their TypeScript projects.

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

0 participants