Skip to content

Commit 179a66b

Browse files
Migrate demo/index.tsx to plain ts file (#297)
1 parent 300653e commit 179a66b

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

demo/index.tsx demo/index.ts

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import * as React from 'react';
12
import * as ReactDOMClient from 'react-dom/client';
23

3-
import { GraphQLVoyager } from '../src';
4+
import { Voyager } from '../src';
45
import { defaultPreset, PRESETS } from './presets';
56

67
const currentUrl = new URL(window.location.href);
@@ -25,12 +26,13 @@ const introspection =
2526
}
2627
: defaultPreset;
2728

28-
const reactRoot = ReactDOMClient.createRoot(document.getElementById('root'));
29+
const rootElement = document.getElementById('root');
30+
const reactRoot = ReactDOMClient.createRoot(rootElement);
2931
reactRoot.render(
30-
<GraphQLVoyager
31-
introspection={introspection}
32-
introspectionPresets={PRESETS}
33-
allowToChangeSchema={true}
34-
hideVoyagerLogo={false}
35-
/>,
32+
React.createElement(Voyager, {
33+
introspection,
34+
introspectionPresets: PRESETS,
35+
allowToChangeSchema: true,
36+
hideVoyagerLogo: false,
37+
}),
3638
);

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"./src/**/*.ts",
2222
"./src/**/*.tsx",
2323
"./manual-types.d.ts",
24-
"demo/**/*.tsx",
24+
"demo/**/*.ts",
2525
"tests/**/*.ts",
2626
"scripts/**/*.ts",
2727
"playwright.config.ts",

webpack-demo.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function buildWebpackConfig(): webpack.Configuration {
1717
extensions: ['.ts', '.tsx', '.mjs', '.js', '.json', '.css', '.svg'],
1818
alias: { '../../worker': '../../worker-dist' },
1919
},
20-
entry: './demo/index.tsx',
20+
entry: './demo/index.ts',
2121
devServer: {
2222
https: true,
2323
port: 9090,

0 commit comments

Comments
 (0)