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

render()返回值类型错误 #4853

Closed
15802980231 opened this issue Mar 29, 2023 · 2 comments · Fixed by #4861
Closed

render()返回值类型错误 #4853

15802980231 opened this issue Mar 29, 2023 · 2 comments · Fixed by #4861
Assignees
Labels
Milestone

Comments

@15802980231
Copy link

export interface Chart extends Composition, Mark {
  render(): void;
  node(): HTMLElement;
  data: ValueAttribute<ChartProps['data'], Chart>;
  width: ValueAttribute<ChartProps['width'], Chart>;
  height: ValueAttribute<ChartProps['height'], Chart>;
  coordinate: ValueAttribute<ChartProps['coordinate'], Chart>;
  interaction: ObjectAttribute<ChartProps['interaction'], Chart>;
  key: ValueAttribute<ChartProps['key'], Chart>;
  transform: ArrayAttribute<ChartProps['transform'], Chart>;
  theme: ObjectAttribute<ChartProps['theme'], Chart>;
  title: ValueAttribute<ChartProps['title'], Chart>;
  scale: ObjectAttribute<ChartOptions['scale'], Chart>;
  axis: ObjectAttribute<ChartOptions['axis'], Chart>;
  legend: ObjectAttribute<ChartOptions['legend'], Chart>;
  style: ObjectAttribute<ChartOptions['style'], Chart>;
  labelTransform: ArrayAttribute<ChartOptions['labelTransform'], Chart>;
}

 render(): Promise<Chart> {
    if (!this._context.canvas) {
      // Init width and height.
      const {
        width = 640,
        height = 480,
        renderer,
        plugins,
        autoFit,
      } = this.options();
      const { width: adjustedWidth, height: adjustedHeight } = getChartSize(
        this._container,
        autoFit,
        width,
        height,
      );
      this.width(adjustedWidth);
      this.height(adjustedHeight);

      // Create canvas if it does not exist.
      this._context.canvas = Canvas(
        this._container,
        width,
        height,
        renderer,
        plugins,
      );
    }

    return new Promise((resolve, reject) => {
      try {
        reneder(this.options(), this._context, () => resolve(this), reject);
      } catch (e) {
        reject(e);
      }
    });
  }
@pearmini
Copy link
Member

有具体的错误提示吗?

@15802980231
Copy link
Author

有具体的错误提示吗?
接口中返回值是void,但实际返回的类型是Promise

@pearmini pearmini added this to the 5.0.2 milestone Mar 30, 2023
pepper-nice added a commit that referenced this issue Apr 3, 2023
pepper-nice added a commit that referenced this issue Apr 3, 2023
@pearmini pearmini linked a pull request Apr 4, 2023 that will close this issue
@pearmini pearmini closed this as completed Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants