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

This is a prep commit for typescript migration for `stats.js`,
which used a third party module `plotly.js` that doesn't come
with types.
This commit is contained in:
Junyao Chen 2023-06-27 11:27:20 -04:00 committed by Tim Abbott
parent 640de3ad29
commit 6757c5a9f8
5 changed files with 29 additions and 1 deletions

View File

@ -100,6 +100,7 @@
"@types/micromodal": "^0.3.3", "@types/micromodal": "^0.3.3",
"@types/minimalistic-assert": "^1.0.1", "@types/minimalistic-assert": "^1.0.1",
"@types/node": "^18.8.3", "@types/node": "^18.8.3",
"@types/plotly.js": "^2.12.20",
"@types/sortablejs": "^1.15.1", "@types/sortablejs": "^1.15.1",
"@types/turndown": "^5.0.1", "@types/turndown": "^5.0.1",
"@typescript-eslint/eslint-plugin": "^6.1.0", "@typescript-eslint/eslint-plugin": "^6.1.0",

View File

@ -298,6 +298,9 @@ devDependencies:
'@types/node': '@types/node':
specifier: ^18.8.3 specifier: ^18.8.3
version: 18.16.20 version: 18.16.20
'@types/plotly.js':
specifier: ^2.12.20
version: 2.12.20
'@types/sortablejs': '@types/sortablejs':
specifier: ^1.15.1 specifier: ^1.15.1
version: 1.15.1 version: 1.15.1
@ -2987,6 +2990,10 @@ packages:
resolution: {integrity: sha512-O397rnSS9iQI4OirieAtsDqvCj4+3eY1J+EPdNTKuHuRWIfUoGyzX294o8C4KJYaLqgSrd2o60c5EqCU8Zv02g==} resolution: {integrity: sha512-O397rnSS9iQI4OirieAtsDqvCj4+3eY1J+EPdNTKuHuRWIfUoGyzX294o8C4KJYaLqgSrd2o60c5EqCU8Zv02g==}
dev: true dev: true
/@types/plotly.js@2.12.20:
resolution: {integrity: sha512-ZDNAde0VqBCrcgmQQyOmWM71k1+5oWaNkfliZ4ix5IdBkjbLye1S6JIdw+XFWGAIeimpjnkLsLzMOwQ105eIOg==}
dev: true
/@types/qs@6.9.7: /@types/qs@6.9.7:
resolution: {integrity: sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==} resolution: {integrity: sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==}

View File

@ -132,6 +132,7 @@ EXEMPT_FILES = make_set(
"web/src/overlays.ts", "web/src/overlays.ts",
"web/src/padded_widget.ts", "web/src/padded_widget.ts",
"web/src/page_params.ts", "web/src/page_params.ts",
"web/src/plotly.js.d.ts",
"web/src/pm_list.js", "web/src/pm_list.js",
"web/src/pm_list_dom.js", "web/src/pm_list_dom.js",
"web/src/poll_widget.js", "web/src/poll_widget.js",

View File

@ -48,4 +48,4 @@ API_FEATURE_LEVEL = 203
# historical commits sharing the same major version, in which case a # historical commits sharing the same major version, in which case a
# minor version bump suffices. # minor version bump suffices.
PROVISION_VERSION = (246, 1) PROVISION_VERSION = (246, 2)

19
web/src/plotly.js.d.ts vendored Normal file
View File

@ -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;
}