From 4dc09fe6f895ddfe28ae118b924edcfb91c442cd Mon Sep 17 00:00:00 2001 From: xcy960815 <18763006837@163.com> Date: Tue, 29 Aug 2023 10:06:32 +0800 Subject: [PATCH 1/2] fix(types): export ChartOptions replace RuntimeOptions --- src/api/chart.ts | 3 +++ src/api/index.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/api/chart.ts b/src/api/chart.ts index 91d424dc7a..59924cbd5c 100644 --- a/src/api/chart.ts +++ b/src/api/chart.ts @@ -2,7 +2,10 @@ import { G2Spec } from '../spec'; import { extend, API } from './extend'; import { library } from './library'; import { Runtime } from './runtime'; +import type { RuntimeOptions } from './runtime'; export interface Chart extends API {} export const Chart = extend(Runtime, library); + +export type ChartOptions = Omit; diff --git a/src/api/index.ts b/src/api/index.ts index 0dd28777fc..8802486466 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,4 +1,4 @@ -export { Chart } from './chart'; +export { Chart, type ChartOptions } from './chart'; export { MarkNode } from './mark'; export { CompositionNode } from './composition'; export { register } from './library'; From 050a48d4bb48910bd72bb8b569e88df8193ada81 Mon Sep 17 00:00:00 2001 From: xcy960815 <18763006837@163.com> Date: Tue, 29 Aug 2023 16:48:42 +0800 Subject: [PATCH 2/2] fix: render is not a function on page init and ignore package-lock.json --- .gitignore | 5 ++++- __tests__/main.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e6c26dc825..2fa851ea69 100644 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,7 @@ site/.dumi/tmp-production # Other !/src/lib -!/__tests__/unit/lib \ No newline at end of file +!/__tests__/unit/lib + +# Package +package-lock.json \ No newline at end of file diff --git a/__tests__/main.ts b/__tests__/main.ts index 8ab319088a..51ce8e3365 100644 --- a/__tests__/main.ts +++ b/__tests__/main.ts @@ -118,7 +118,7 @@ async function plot() { currentContainer = document.createElement('div'); app.append(currentContainer); const render = tests[selectChart.value]; - render(currentContainer); + render && render(currentContainer); } function createOption(key) {