Merge remote-tracking branch 'origin/main' into explore-git-sync-improvements

This commit is contained in:
hugocasa
2026-07-06 21:45:27 +02:00
81 changed files with 3211 additions and 513 deletions
+1 -1
View File
@@ -10,4 +10,4 @@ export const WM_FORK_PREFIX = "wm-fork";
// (e.g. utils.ts) can read it without importing main.ts and creating a circular
// dependency (main → workspace → utils → main) that triggers a TDZ.
// Re-exported from main.ts for backwards compatibility.
export const VERSION = "1.749.0";
export const VERSION = "1.751.0";
+7 -3
View File
@@ -1,5 +1,9 @@
import { Schema, SchemaProperty } from "../../bootstrap/common.ts";
function quotePropName(name: string): string {
return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name) ? name : JSON.stringify(name);
}
export function compileResourceTypeToTsType(schema: Schema) {
function rec(x: { [name: string]: SchemaProperty }, root = false) {
let res = "{\n";
@@ -10,15 +14,15 @@ export function compileResourceTypeToTsType(schema: Schema) {
let i = 0;
for (let [name, prop] of entries) {
if (prop.type == "object") {
res += ` ${name}: ${rec(prop.properties ?? {})}`;
res += ` ${quotePropName(name)}: ${rec(prop.properties ?? {})}`;
} else if (prop.type == "array") {
res += ` ${name}: ${prop?.items?.type ?? "any"}[]`;
res += ` ${quotePropName(name)}: ${prop?.items?.type ?? "any"}[]`;
} else {
let typ = prop?.type ?? "any";
if (typ == "integer") {
typ = "number";
}
res += ` ${name}: ${typ}`;
res += ` ${quotePropName(name)}: ${typ}`;
}
i++;
if (i < entries.length) {