Merge pull request 'fix(workflow): resolve type errors across all packages' (#16) from fix/type-errors-and-tsbuildinfo into main

This commit is contained in:
2026-05-06 09:44:49 +00:00
20 changed files with 38 additions and 26 deletions
+1
View File
@@ -2,3 +2,4 @@ node_modules/
dist/
bun.lock
*.tgz
tsconfig.tsbuildinfo
+3 -1
View File
@@ -12,6 +12,8 @@
"test": "bun run --filter '*' test"
},
"devDependencies": {
"@biomejs/biome": "^2.4.14"
"@biomejs/biome": "^2.4.14",
"@types/xxhashjs": "^0.2.4",
"bun-types": "^1.3.13"
}
}
+2 -2
View File
@@ -1,4 +1,4 @@
import { type ChildProcessWithoutNullStreams, spawn } from "node:child_process";
import { type ChildProcess, spawn } from "node:child_process";
import { mkdir, readdir, unlink, writeFile } from "node:fs/promises";
import { createConnection } from "node:net";
import { join } from "node:path";
@@ -23,7 +23,7 @@ function isProcessAlive(pid: number): boolean {
async function waitForReadyLine(
childStdout: NodeJS.ReadableStream,
child: ChildProcessWithoutNullStreams,
child: ChildProcess,
): Promise<Result<number, string>> {
return await new Promise((resolve) => {
let buf = "";
+2 -1
View File
@@ -14,7 +14,8 @@
"sourceMap": true,
"composite": true,
"outDir": "dist",
"rootDir": "src"
"rootDir": "src",
"types": ["bun-types"]
},
"references": [{ "path": "../workflow" }],
"include": ["src/**/*.ts"]
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -12,5 +12,8 @@
"@uncaged/workflow": "workspace:*",
"@uncaged/workflow-util-role": "workspace:*",
"zod": "^4.0.0"
},
"devDependencies": {
"@types/node": "^25.6.0"
}
}
@@ -3,7 +3,8 @@
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
"composite": true
"composite": true,
"types": ["bun-types"]
},
"include": ["src/**/*.ts"],
"references": [{ "path": "../workflow" }, { "path": "../workflow-util-role" }]
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+18 -7
View File
@@ -10,6 +10,17 @@ import type {
Program,
VariableDeclaration,
} from "acorn";
/** Acorn Node with index-access for property traversal. */
type AcornNode = Node & { [key: string]: unknown };
/**
* Narrow an Acorn Node to a specific AST subtype after a `.type` guard.
* Avoids double-cast (`as unknown as T`) by going through AcornNode.
*/
function narrowNode<T extends Node>(node: Node): T {
return node as unknown as T;
}
import * as acorn from "acorn";
import { err, ok, type Result } from "./result.js";
@@ -55,7 +66,7 @@ function pushNestedAstNodes(value: unknown, out: Node[]): void {
function collectChildNodes(node: Node): Node[] {
const children: Node[] = [];
for (const key of Object.keys(node)) {
const val = (node as Record<string, unknown>)[key];
const val = (node as AcornNode)[key];
pushNestedAstNodes(val, children);
}
return children;
@@ -273,10 +284,10 @@ function descriptorExportExists(program: Program): boolean {
}
function stringLiteralModuleSpecifier(src: Node): string | null {
if (src.type !== "Literal" || typeof src.value !== "string") {
if (src.type !== "Literal" || typeof (src as AcornNode).value !== "string") {
return null;
}
return src.value;
return (src as AcornNode).value as string;
}
function validateImportDeclaration(node: ImportDeclaration): string | null {
@@ -337,16 +348,16 @@ function bundleConstraintViolationForNode(node: Node): string | null {
return "dynamic import() is not allowed in workflow bundles";
}
if (node.type === "ImportDeclaration") {
return validateImportDeclaration(node);
return validateImportDeclaration(narrowNode<ImportDeclaration>(node));
}
if (node.type === "ExportNamedDeclaration") {
return validateExportNamedDeclaration(node);
return validateExportNamedDeclaration(narrowNode<ExportNamedDeclaration>(node));
}
if (node.type === "ExportAllDeclaration") {
return validateExportAllDeclaration(node);
return validateExportAllDeclaration(narrowNode<ExportAllDeclaration>(node));
}
if (node.type === "CallExpression") {
return validateRequireCall(node);
return validateRequireCall(narrowNode<CallExpression>(node));
}
return null;
}
@@ -69,7 +69,7 @@ export function createRoleModerator<M extends RoleMeta>(
return { returnCode: 1, summary: `unknown role: ${next}` };
}
const result = await roleFn(ctx);
const result = await roleFn(ctx as unknown as ThreadContext);
const ts = Date.now();
const step = {
role: next,
+2 -2
View File
@@ -423,7 +423,7 @@ async function main(): Promise<void> {
});
}
const server = createServer((socket) => {
const server = createServer((socket: Socket) => {
void (async () => {
const line = await readLineFromSocket(socket);
if (line === null) {
@@ -439,7 +439,7 @@ async function main(): Promise<void> {
})();
});
server.on("error", (errObj) => {
server.on("error", (errObj: Error) => {
bootLog("W8YK4NPX", `worker server error: ${errObj.message}`);
process.exit(1);
});
+2 -1
View File
@@ -14,7 +14,8 @@
"sourceMap": true,
"composite": true,
"outDir": "dist",
"rootDir": "src"
"rootDir": "src",
"types": ["bun-types"]
},
"include": ["src/**/*.ts", "xxhashjs.d.ts"]
}
File diff suppressed because one or more lines are too long
+2 -1
View File
@@ -13,7 +13,8 @@
"declarationMap": true,
"sourceMap": true,
"composite": true,
"outDir": "dist"
"outDir": "dist",
"types": ["bun-types"]
},
"references": [
{ "path": "packages/workflow" },