fix(type-check): clear the last five failures — monorepo type-check is now 76/76 green

After the mobile-app deletion unblocked \`@context/mobile\`, five more
pre-existing failures surfaced across shared packages and two services.
All were silent-masked by the postinstall \`|| true\` for months.

- **shared-ai**: \`planner/loop.ts\` imported \`ToolSchema\` from
  \`../tools/function-schema\`, which only imports (not re-exports) the
  type. Fixed to import from the source (\`../tools/schemas\`).
- **shared-logger**: \`typeof window !== 'undefined'\` blows up under
  tsconfigs that don't include the DOM lib (e.g. uload-server's
  \`bun-types\`-only config), because shared-logger is consumed via
  source import. Replaced with a \`globalThis\`-indirected check that
  compiles under any lib configuration.
- **shared-hono**: \`credits.ts\` returned \`res.json()\` directly as
  \`Promise<T | null>\`. Modern \`@types/node\` / undici types return
  \`unknown\` strictly — cast to \`T\` at the boundary so the generic
  contract is explicit.
- **uload-server**: \`routes/analytics.ts\` + \`routes/email.ts\` still
  imported \`AuthUser\` from a \`middleware/jwt-auth\` module that was
  deleted during the migration to \`@mana/shared-hono\`. Replaced with
  \`AuthVariables\` from shared-hono, which matches the actual context
  shape set by \`authMiddleware()\`.
- **manavoxel/web**: \`guestSeed\` collection entries were wrapped in
  arrow functions, but \`local-store\` expects \`T[]\` directly and
  iterates \`seed.length\` — which on a function is 0. The "guest
  seed" was silently dead; eager-evaluating \`generateGuestWorld()\`
  once and sharing the result fixes both the type and the runtime.

Verified: \`pnpm run type-check\` from the repo root now exits 0 —
76/76 tasks successful, no failures. First fully green state since
well before the postinstall \`|| true\` was introduced.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-04-20 15:53:07 +02:00
parent a44e3df1d0
commit 0077752456
7 changed files with 22 additions and 10 deletions

View file

@ -10,7 +10,8 @@
* ``onToolCall`` callback. The loop itself stays pure.
*/
import type { ToolSchema, ToolSpec } from '../tools/function-schema';
import type { ToolSchema } from '../tools/schemas';
import type { ToolSpec } from '../tools/function-schema';
import { toolsToFunctionSchemas } from '../tools/function-schema';
// ─── Chat-message contract ──────────────────────────────────────────

View file

@ -42,7 +42,7 @@ async function callCredits<T>(path: string, options: RequestInit = {}): Promise<
},
});
if (!res.ok) return null;
return res.json();
return (await res.json()) as T;
} catch (error) {
console.error('[credits] Request failed:', error);
return null;

View file

@ -15,7 +15,10 @@ declare const __DEV__: boolean | undefined;
const isDevelopment =
typeof __DEV__ !== 'undefined' ? __DEV__ : process.env.NODE_ENV === 'development';
const isBrowser = typeof window !== 'undefined';
// Use a globalThis indirection instead of `typeof window` so this module
// stays compilable under tsconfigs that don't pull in the DOM lib (e.g.
// Bun-only services consuming shared-logger via workspace source imports).
const isBrowser = typeof (globalThis as { window?: unknown }).window !== 'undefined';
const useJson =
process.env.LOGGER_FORMAT === 'json' ||

View file

@ -3,6 +3,7 @@
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"lib": ["ES2022", "DOM"],
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true,