Skip to content

Commit 4b4bf59

Browse files
authored
add typecheck script to react-router-dev (#12294)
1 parent a53f483 commit 4b4bf59

File tree

6 files changed

+14
-18
lines changed

6 files changed

+14
-18
lines changed

packages/react-router-dev/__tests__/cli-test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ describe("remix CLI", () => {
121121
--config, -c Use specified Vite config file (string)
122122
--no-typescript Generate plain JavaScript files
123123
\`typegen\` Options:
124-
--config, -c Use specified Vite config file (string)
125124
--watch Automatically regenerate types whenever route config (\`routes.ts\`) or route modules change
126125
127126
Build your project:
@@ -150,8 +149,7 @@ describe("remix CLI", () => {
150149
Generate types for route modules:
151150
152151
$ react-router typegen
153-
$ react-router typegen --watch
154-
$ react-router typegen --config vite.react-router.config.ts"
152+
$ react-router typegen --watch"
155153
`);
156154
});
157155
});

packages/react-router-dev/cli/commands.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,16 +197,13 @@ async function createClientEntry(
197197
return contents;
198198
}
199199

200-
export async function typegen(
201-
root: string,
202-
flags: { watch: boolean; config?: string }
203-
) {
200+
export async function typegen(root: string, flags: { watch: boolean }) {
204201
root ??= process.cwd();
205202

206203
if (flags.watch) {
207-
await Typegen.watch(root, flags.config);
204+
await Typegen.watch(root);
208205
await new Promise(() => {}); // keep alive
209206
return;
210207
}
211-
await Typegen.run(root, flags.config);
208+
await Typegen.run(root);
212209
}

packages/react-router-dev/cli/run.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ ${colors.blueBright("react-router")}
4646
--config, -c Use specified Vite config file (string)
4747
--no-typescript Generate plain JavaScript files
4848
\`typegen\` Options:
49-
--config, -c Use specified Vite config file (string)
5049
--watch Automatically regenerate types whenever route config (\`routes.ts\`) or route modules change
5150
5251
${colors.underline("Build your project")}:
@@ -76,7 +75,6 @@ ${colors.blueBright("react-router")}
7675
7776
$ react-router typegen
7877
$ react-router typegen --watch
79-
$ react-router typegen --config vite.react-router.config.ts
8078
`;
8179

8280
/**

packages/react-router-dev/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
"react-router": "bin.js"
3636
},
3737
"scripts": {
38-
"build": "wireit"
38+
"build": "wireit",
39+
"typecheck": "tsc"
3940
},
4041
"wireit": {
4142
"build": {

packages/react-router-dev/tsconfig.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66
"target": "ES2022",
77
"module": "ES2022",
88
"moduleResolution": "Bundler",
9-
"resolveJsonModule": true,
10-
"allowSyntheticDefaultImports": true,
9+
1110
"strict": true,
1211
"jsx": "react",
12+
1313
"skipLibCheck": true,
14-
"declaration": true,
15-
"emitDeclarationOnly": true,
14+
15+
"outDir": "dist",
1616
"rootDir": ".",
17-
"outDir": "./dist"
17+
"noEmit": true,
18+
"resolveJsonModule": true,
19+
"allowSyntheticDefaultImports": true
1820
}
1921
}

packages/react-router-dev/vite/styles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { ServerBuild } from "react-router";
33
import { matchRoutes } from "react-router";
44
import type { ModuleNode, ViteDevServer } from "vite";
55

6-
import type { ResolvedReactRouterConfig } from "./config";
6+
import type { ResolvedReactRouterConfig } from "../config/config";
77
import { resolveFileUrl } from "./resolve-file-url";
88

99
type ServerRouteManifest = ServerBuild["routes"];

0 commit comments

Comments
 (0)