{
  "slug": "wrangler-exposes-experimental-experimental-generatetypes-api-2581a66d0b2d",
  "title": "wrangler exposes experimental experimental_generateTypes() API",
  "tools": [
    "wrangler"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-04-30T16:59:25.000Z",
  "announced_at": "2026-04-30T16:59:25.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When code needs Worker types from Wrangler’s generation logic, import `experimental_generateTypes` from `wrangler` and await it with an optional options object. Use its `env` and `runtime` strings or combined `content`; the API does not write the output to disk automatically.",
    "examples": [
      "import { experimental_generateTypes } from \"wrangler\";\n\nconst result = await experimental_generateTypes({\n  config: \"<wrangler-config>\",\n  includeRuntime: true,\n  includeEnv: true,\n});\n\n// Use result.env, result.runtime, or result.content."
    ],
    "gotchas": [
      "Version: 4.87.0",
      "Availability: experimental",
      "options: Optional options object mirroring core `wrangler types` options.",
      "config: Wrangler config path; accepts a string or array for multi-config type resolution.",
      "env: Wrangler environment name for type generation.",
      "includeEnv: Include environment and bindings types; defaults to `true`.",
      "includeRuntime: Include runtime types; defaults to `true`.",
      "envInterface: Name the generated environment interface; defaults to `Env`.",
      "envFile: Paths to `.env` files used to infer local variables and secrets.",
      "path: Target declaration file path; defaults to `worker-configuration.d.ts`.",
      "strictVars: Generate strict literal and union types for variables; defaults to `true`.",
      "Supports the same core type-generation options as `wrangler types`, including env/runtime toggles."
    ]
  },
  "why_it_matters": "Generate Worker types programmatically in code using Wrangler's type-generation logic.",
  "sources": [
    "https://github.com/cloudflare/workers-sdk/releases/tag/wrangler%404.87.0",
    "https://developers.cloudflare.com/workers/wrangler/api/"
  ],
  "rank": 0.92021,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v1+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "backfill-20261007",
    "verdict_id": "backfill-20261007:backfill-20261007-d23547010d90bb6c-1:gate",
    "evidence_hash": "87fa592f3d0fe49dabaccba83496e4da914de0c7c9b5fa70355417b7501f90eb"
  },
  "review": {
    "draft_hash": "3e7736888bf8d116fef4d65651c3c25a724a84c439a0a9e60df673b1cdbc2788",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "backfill-20261007:gate",
    "reason": "2 of 3 judge runs approved with p_yes >= 0.9 (mean 0.92 >= 0.9; 2 needed) and Jev gave 0.68 (>= 0.6 needed)."
  }
}
