Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion reference_gen/node-types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Node, Project, ts } from "ts-morph";
import { Node, Project, SourceFile, ts } from "ts-morph";
import EXCLUDE_MAP from "./node-exclude-map.json" with { type: "json" };
import { Description, generateDescriptions } from "../runtime/_data.ts";

Expand Down Expand Up @@ -216,6 +216,15 @@ function getNote(description: Description) {
return `:::${description.kind} Deno compatibility\n\n${description.description}\n\n:::\n`;
}

function annotateHttpClientRequestArgs(file: SourceFile) {
const clientRequestArgs = file.getInterface("ClientRequestArgs");
const timeout = clientRequestArgs?.getProperty("timeout");

if (timeout && timeout.getJsDocs().length === 0) {
timeout.addJsDoc("Timeout in milliseconds.");
}
}

for (const file of importRewriteProject.getSourceFiles()) {
const moduleName = file.getFilePath().slice(Deno.cwd().length + 1, -5);

Expand Down Expand Up @@ -277,6 +286,10 @@ for (const file of importRewriteProject.getSourceFiles()) {
}
}

if (moduleName === "node__http") {
annotateHttpClientRequestArgs(file);
}

modules[moduleName] = file.getFullText();
}

Expand Down
Loading