Skip to content

Commit

Permalink
Fix another type error
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrtenz committed Jan 14, 2025
1 parent a5fc667 commit 72e2452
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions packages/snaps-cli/src/commands/watch/implementation.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { assert } from '@metamask/utils';
import { basename } from 'path';
import type { Watching } from 'webpack';

Expand Down Expand Up @@ -39,6 +40,11 @@ export async function watch(
return;
}

assert(
compiler.watching,
'Expected `compiler.watching` to be defined.',
);

resolve(compiler.watching);
},
);
Expand Down
10 changes: 8 additions & 2 deletions packages/snaps-cli/src/webpack/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import type { Ora } from 'ora';
import type {
Compiler,
ProvidePlugin,
ResolvePluginInstance,
Resolver,
StatsError,
WebpackPluginInstance,
Expand Down Expand Up @@ -231,6 +230,13 @@ export class SnapsWatchPlugin implements WebpackPluginInstance {
}
}

/**
* Webpack's resolver plugin interface, which is not exported by Webpack.
*/
type ResolverPlugin = {
apply: (resolver: Resolver) => void;
};

/**
* The options for the {@link SnapsBuiltInResolver}.
*/
Expand All @@ -247,7 +253,7 @@ export type SnapsBuiltInResolverOptions = {
* plugin is used to warn the user when they try to import a built-in module,
* when no fallback is configured.
*/
export class SnapsBuiltInResolver implements ResolvePluginInstance {
export class SnapsBuiltInResolver implements ResolverPlugin {
/**
* The built-in modules that have been imported, but not resolved.
*/
Expand Down

0 comments on commit 72e2452

Please sign in to comment.