Skip to content

Commit 311de8b

Browse files
committed
Relax React version
Signed-off-by: Andrew Stein <steinlink@gmail.com>
1 parent a248b91 commit 311de8b

12 files changed

Lines changed: 96 additions & 133 deletions

File tree

packages/react/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"rootDir": "./src",
1010
"moduleResolution": "bundler",
1111
"skipLibCheck": true,
12-
"jsx": "react-jsx",
12+
"jsx": "preserve",
1313
},
1414
"files": [
1515
"src/index.tsx"

packages/workspace/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"@perspective-dev/esbuild-plugin": "workspace:",
5050
"@perspective-dev/test": "workspace:",
5151
"@types/lodash": "catalog:",
52+
"@types/react": "catalog:",
5253
"typescript": "catalog:",
5354
"zx": "catalog:"
5455
}

packages/workspace/src/ts/extensions.ts

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
1111
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
1212

13-
import { HTMLPerspectiveWorkspaceElement } from "./perspective-workspace";
13+
import type { HTMLPerspectiveWorkspaceElement } from "./perspective-workspace";
14+
import type * as React from "react";
1415

1516
type ReactPerspectiveWorkspaceAttributes<T> = React.HTMLAttributes<T>;
1617

@@ -21,6 +22,8 @@ type JsxPerspectiveWorkspaceElement = {
2122
HTMLPerspectiveWorkspaceElement
2223
>;
2324

25+
// React <19
26+
2427
declare global {
2528
namespace JSX {
2629
interface IntrinsicElements {
@@ -29,6 +32,34 @@ declare global {
2932
}
3033
}
3134

35+
// React >=19
36+
37+
// @ts-ignore
38+
declare module "react/jsx-runtime" {
39+
namespace JSX {
40+
interface IntrinsicElements {
41+
"perspective-workspace": JsxPerspectiveWorkspaceElement;
42+
}
43+
}
44+
}
45+
46+
// @ts-ignore
47+
declare module "react/jsx-dev-runtime" {
48+
namespace JSX {
49+
interface IntrinsicElements {
50+
"perspective-workspace": JsxPerspectiveWorkspaceElement;
51+
}
52+
}
53+
}
54+
55+
declare module "react" {
56+
namespace JSX {
57+
interface IntrinsicElements {
58+
"perspective-workspace": JsxPerspectiveWorkspaceElement;
59+
}
60+
}
61+
}
62+
3263
// Custom Elements extensions
3364

3465
declare global {

packages/workspace/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"compilerOptions": {
3+
"jsx": "preserve",
34
"strict": true,
45
"module": "ESNext",
56
"target": "ESNext",

pnpm-lock.yaml

Lines changed: 17 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ catalog:
3737
"d3fc": "^15.2.13"
3838
"ol": "^5.3.2"
3939
"pro_self_extracting_wasm": "0.0.9"
40-
"react-dom": "^18"
41-
"react": "^18"
40+
"react-dom": ">17 <20"
41+
"react": ">17 <20"
4242
"regular-table": "=0.8.1"
4343
"stoppable": "=1.1.0"
4444
"ws": "^8.17.0"
@@ -56,8 +56,8 @@ catalog:
5656
"@types/d3": "^7.4.3"
5757
"@types/lodash": "^4.17.20"
5858
"@types/node": ">=22"
59-
"@types/react-dom": "^18"
60-
"@types/react": "^18"
59+
"@types/react-dom": ">17 <20"
60+
"@types/react": ">17 <20"
6161
"@types/stoppable": ">=1"
6262
"@types/ws": ">=8"
6363
"@types/chroma-js": "^3.1.2"

rust/perspective-viewer/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"@playwright/test": "catalog:",
4848
"@playwright/experimental-ct-react": "catalog:",
4949
"@types/react": "catalog:",
50+
"@types/react-dom": "catalog:",
5051
"prettier": "catalog:",
5152
"typedoc": "catalog:",
5253
"typescript": "catalog:",

rust/perspective-viewer/src/ts/extensions.ts

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,15 @@ export type PerspectiveSelectEventDetail = {
4848

4949
type ReactPerspectiveViewerAttributes<T> = React.HTMLAttributes<T>;
5050

51-
type JsxPerspectiveViewerElement = { class?: string } & React.DetailedHTMLProps<
51+
type JsxPerspectiveViewerElement = {
52+
class?: string;
53+
} & React.DetailedHTMLProps<
5254
ReactPerspectiveViewerAttributes<HTMLPerspectiveViewerElement>,
5355
HTMLPerspectiveViewerElement
5456
>;
5557

58+
// React <19
59+
5660
declare global {
5761
namespace JSX {
5862
interface IntrinsicElements {
@@ -61,6 +65,39 @@ declare global {
6165
}
6266
}
6367

68+
// React >=19
69+
70+
// Why are these `ts-ignore`? React 19 makes choice of JSX runtime in `tsconfig`
71+
// the determination of which runtime this needs to be, but this is chosen
72+
// by the user ... so I'm not sure what the React authors want from me here
73+
// exactly. Divination?
74+
75+
// @ts-ignore
76+
declare module "react/jsx-runtime" {
77+
namespace JSX {
78+
interface IntrinsicElements {
79+
"perspective-viewer": JsxPerspectiveViewerElement;
80+
}
81+
}
82+
}
83+
84+
// @ts-ignore
85+
declare module "react/jsx-dev-runtime" {
86+
namespace JSX {
87+
interface IntrinsicElements {
88+
"perspective-viewer": JsxPerspectiveViewerElement;
89+
}
90+
}
91+
}
92+
93+
declare module "react" {
94+
namespace JSX {
95+
interface IntrinsicElements {
96+
"perspective-viewer": JsxPerspectiveViewerElement;
97+
}
98+
}
99+
}
100+
64101
// Custom Elements extensions
65102

66103
declare global {

rust/perspective-viewer/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"compilerOptions": {
3+
"jsx": "preserve",
34
"strict": true,
45
"module": "ESNext",
56
"target": "ESNext",

tools/scripts/fix.mjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import * as url from "url";
1414
import * as dotenv from "dotenv";
1515
import { lint_js, lint_python } from "./lint.mjs";
16-
import * as cppLint from "./lint_cpp.mjs";
1716

1817
if (import.meta.url.startsWith("file:")) {
1918
if (process.argv[1] === url.fileURLToPath(import.meta.url)) {
@@ -23,6 +22,5 @@ if (import.meta.url.startsWith("file:")) {
2322
dotenv.config({ path: "./.perspectiverc", quiet: true });
2423
await lint_js(true);
2524
lint_python(true);
26-
cppLint.fixFormatting();
2725
}
2826
}

0 commit comments

Comments
 (0)