Skip to content

Commit c108388

Browse files
tylersayshidai-shi
andauthored
fix: type checking for waku unit tests not working (#948)
This fixes type checking for the waku unit tests both in CI and in the editor --------- Co-authored-by: Tyler <[email protected]> Co-authored-by: Daishi Kato <[email protected]>
1 parent eed66ba commit c108388

6 files changed

+23
-4
lines changed

packages/waku/src/router/create-pages.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ export function createPages<
405405
/** This for type inference of the router only. We do not actually return anything for this type. */
406406
DO_NOT_USE_pages: Exclude<
407407
Exclude<Awaited<Exclude<typeof ready, undefined>>, void>[number],
408-
void
408+
void // createLayout returns void
409409
>;
410410
};
411411
}

packages/waku/tests/buffer.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, it, expect } from 'vitest';
2-
import { bufferToString, parseFormData } from '../src/lib/utils/buffer';
2+
import { bufferToString, parseFormData } from '../src/lib/utils/buffer.js';
33

44
// Minimal valid 1x1 pixel PNG image
55
const PNG_HEADER = new Uint8Array([

packages/waku/tests/create-pages.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { createPages } from '../src/router/create-pages.js';
44
import type {
55
CreateLayout,
66
CreatePage,
7-
GetSlugs,
87
HasSlugInPath,
98
HasWildcardInPath,
109
IsValidPathInSlugPath,
@@ -20,6 +19,7 @@ import { renderToString } from 'react-dom/server';
2019
import { expectType } from 'ts-expect';
2120
import type { TypeEqual } from 'ts-expect';
2221
import type { PathsForPages } from '../src/router/base-types.js';
22+
import type { GetSlugs } from '../src/router/create-pages-utils/inferred-path-types.js';
2323

2424
function Fake() {
2525
return null;

packages/waku/tests/tsconfig.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"extends": "../../../tsconfig.json",
3+
"compilerOptions": {
4+
"rootDir": "..",
5+
"outDir": "./dist",
6+
"lib": ["esnext"]
7+
},
8+
"include": ["."],
9+
"references": [
10+
{
11+
"path": ".."
12+
}
13+
]
14+
}

packages/waku/tests/vite-plugin-fs-router-typegen.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import {
55
toIdentifier,
66
} from '../src/lib/plugins/vite-plugin-fs-router-typegen.js';
77
import { fileURLToPath } from 'node:url';
8-
import { FSWatcher, ViteDevServer } from 'vite';
8+
import type { ViteDevServer } from 'vite';
9+
import { FSWatcher } from 'vite';
910
import { writeFile } from 'node:fs/promises';
1011

1112
const root = fileURLToPath(new URL('./fixtures', import.meta.url));

tsconfig.json

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
// E2E
4040
{
4141
"path": "./tsconfig.e2e.json"
42+
},
43+
// Test
44+
{
45+
"path": "./packages/waku/tests"
4246
}
4347
]
4448
}

0 commit comments

Comments
 (0)