Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

stats: Install @types/plotly.js for type check.

Junyao Chen6757c5a9f878
diff --git a/package.json b/package.json
index ce0841cd8d1..0c5ca9f28ad 100644
--- a/package.json
+++ b/package.json
@@ -100,6 +100,7 @@
"@types/micromodal": "^0.3.3",
"@types/minimalistic-assert": "^1.0.1",
"@types/node": "^18.8.3",
+ "@types/plotly.js": "^2.12.20",
"@types/sortablejs": "^1.15.1",
"@types/turndown": "^5.0.1",
"@typescript-eslint/eslint-plugin": "^6.1.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index c6ae01cc3ea..40b28bb2a2e 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -298,6 +298,9 @@ devDependencies:
'@types/node':
specifier: ^18.8.3
version: 18.16.20
+ '@types/plotly.js':
+ specifier: ^2.12.20
+ version: 2.12.20
'@types/sortablejs':
specifier: ^1.15.1
version: 1.15.1
@@ -2987,6 +2990,10 @@ packages:
resolution: {integrity: sha512-O397rnSS9iQI4OirieAtsDqvCj4+3eY1J+EPdNTKuHuRWIfUoGyzX294o8C4KJYaLqgSrd2o60c5EqCU8Zv02g==}
dev: true
+ resolution: {integrity: sha512-ZDNAde0VqBCrcgmQQyOmWM71k1+5oWaNkfliZ4ix5IdBkjbLye1S6JIdw+XFWGAIeimpjnkLsLzMOwQ105eIOg==}
+ dev: true
+
resolution: {integrity: sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==}
diff --git a/tools/test-js-with-node b/tools/test-js-with-node
index 856d54afa2c..20469f24ac0 100755
--- a/tools/test-js-with-node
+++ b/tools/test-js-with-node
@@ -132,6 +132,7 @@ EXEMPT_FILES = make_set(
"web/src/overlays.ts",
"web/src/padded_widget.ts",
"web/src/page_params.ts",
+ "web/src/plotly.js.d.ts",
"web/src/pm_list.js",
"web/src/pm_list_dom.js",
"web/src/poll_widget.js",
diff --git a/version.py b/version.py
index 048d143409f..5a4629ac2ab 100644
--- a/version.py
+++ b/version.py
@@ -48,4 +48,4 @@ API_FEATURE_LEVEL = 203
# historical commits sharing the same major version, in which case a
# minor version bump suffices.
-PROVISION_VERSION = (246, 1)
+PROVISION_VERSION = (246, 2)
diff --git a/web/src/plotly.js.d.ts b/web/src/plotly.js.d.ts
new file mode 100644
index 00000000000..cf30165a03c
--- /dev/null
+++ b/web/src/plotly.js.d.ts
@@ -0,0 +1,19 @@
+// An internal type extracted from @types/plotly.js
+// pie and bar are both trace modules from the traces subdirectory
+type TraceModule = {
+ [key: string]: unknown;
+ moduleType: "trace";
+ name: string;
+ categories: string[];
+ meta: Record<string, unknown>;
+};
+
+declare module "plotly.js/lib/pie" {
+ const PlotlyPie: TraceModule;
+ export = PlotlyPie;
+}
+
+declare module "plotly.js/lib/bar" {
+ const PlotlyBar: TraceModule;
+ export = PlotlyBar;
+}