Skip to content

Commit 06535f3

Browse files
committed
✅ Fix typings in tests
1 parent 0a84574 commit 06535f3

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

test/integration/util.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import path from 'node:path';
55
import { promisify } from 'node:util';
66

77
import express, { static as expressStatic } from 'express';
8-
import { Configuration, webpack } from 'webpack';
8+
import { Compiler, Configuration, webpack } from 'webpack';
99

1010
import { createFsFromVolume, Volume } from './volume';
1111

@@ -15,6 +15,8 @@ export interface CompilerFileSystems {
1515
intermediateFileSystem?: Volume;
1616
}
1717

18+
type IntermediateFileSystem = Compiler['intermediateFileSystem'];
19+
1820
export async function compile(
1921
input: Volume,
2022
config: Configuration,
@@ -25,8 +27,8 @@ export async function compile(
2527

2628
compiler.inputFileSystem = createFsFromVolume(input);
2729
compiler.outputFileSystem = createFsFromVolume(output);
28-
compiler.intermediateFileSystem =
29-
intermediateFileSystem ?? (compiler.outputFileSystem as Volume);
30+
compiler.intermediateFileSystem = (intermediateFileSystem ??
31+
compiler.outputFileSystem) as IntermediateFileSystem;
3032

3133
const stats = await promisify(compiler.run.bind(compiler))();
3234
await promisify(compiler.close.bind(compiler))();

test/integration/volume.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
export { createFsFromVolume } from 'memfs';
2-
export { Volume } from 'memfs/lib/volume';
1+
import { createFsFromVolume as memfsCreateFsFromVolume } from 'memfs';
2+
import { Volume } from 'memfs/lib/volume';
3+
import { InputFileSystem, OutputFileSystem } from 'webpack';
4+
5+
export const createFsFromVolume = memfsCreateFsFromVolume as unknown as (
6+
...args: Parameters<typeof memfsCreateFsFromVolume>
7+
) => Volume & InputFileSystem & OutputFileSystem;
8+
9+
export { Volume };

0 commit comments

Comments
 (0)