Skip to content

Commit 5bba954

Browse files
committed
fix(worker): type workflow parser without any cast
1 parent 0fb9a68 commit 5bba954

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

packages/worker/src/workflow/bundler.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import path from 'node:path';
44
import util from 'node:util';
55
import * as unionfs from 'unionfs';
66
import * as memfs from 'memfs';
7-
import type { Configuration } from 'webpack';
7+
import type { Configuration, javascript } from 'webpack';
88
import { webpack, NormalModuleReplacementPlugin } from 'webpack';
99
import type { Logger } from '../logger';
1010
import { DefaultLogger, hasColorSupport } from '../logger';
@@ -241,15 +241,16 @@ exports.importInterceptors = function importInterceptors() {
241241
{
242242
apply: (compiler) => {
243243
compiler.hooks.normalModuleFactory.tap('WorkflowCodeBundler', (normalModuleFactory) => {
244-
for (const moduleType of ['javascript/auto', 'javascript/dynamic', 'javascript/esm']) {
245-
normalModuleFactory.hooks.parser.for(moduleType).tap('WorkflowCodeBundler', (parser) => {
246-
const javascriptParser = parser as any;
247-
javascriptParser.hooks.expression.for('process').tap('WorkflowCodeBundler', () => {
248-
if (!javascriptParser.isVariableDefined('process')) {
249-
this.foundProblematicModules.add('process');
250-
}
244+
for (const moduleType of ['javascript/auto', 'javascript/dynamic', 'javascript/esm'] as const) {
245+
normalModuleFactory.hooks.parser
246+
.for(moduleType)
247+
.tap('WorkflowCodeBundler', (javascriptParser: javascript.JavascriptParser) => {
248+
javascriptParser.hooks.expression.for('process').tap('WorkflowCodeBundler', () => {
249+
if (!javascriptParser.isVariableDefined('process')) {
250+
this.foundProblematicModules.add('process');
251+
}
252+
});
251253
});
252-
});
253254
}
254255
});
255256
},

0 commit comments

Comments
 (0)