AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Next.Js 16.3.0+ Published Types Break TypeScript <6 Due To Missing URLPatternInput/URLPatternOptions Names

Since Next.js 16.3.0, the published .d.ts files reference global type names URLPatternInput, URLPatternOptions, and URLPattern generic parameters that are only available in TypeScript 6.0+. This causes TypeScript 5.x users with skipLibCheck: false to encounter TS2304 errors in next/dist/server/web/spec-extension/url-pattern.d.ts, breaking typechecking for any project that types its next.config.ts.

highConfidence 95%Next.jsServer ActionsReact Server ComponentsAffected V16.3.0Affected V16.4.0-Canary.58

Origin Analysis

Next.js is now built with TypeScript 6, which infers and embeds generic type parameters (URLPatternInput, URLPatternOptions) into the generated declaration for GlobalURLPattern. These names are not present in TypeScript 5.x's lib.dom or @types/node, so they resolve as unknown, producing compilation errors.
1. Create a Next.js project with next >= 16.3.0 and TypeScript 5.9.3. 2. Add a typed next.config.ts file. 3. Set skipLibCheck: false in tsconfig.json. 4. Run tsc --noEmit (or npm run typecheck). 5. Observe 7 errors from node_modules/next/dist/server/web/spec-extension/url-pattern.d.ts regarding missing URLPatternInput, URLPatternOptions, and URLPattern.

Fixing Code Block

Edge Case Audit

This fix assumes that `globalThis.URLPattern` exists in the target environment's TypeScript DOM library. If URLPattern is not defined at all (e.g., very old TypeScript or missing DOM lib), the type becomes `any`, which may mask real type errors. Patching node_modules directly is not persistent across reinstalls; use patch-package or wait for an official Next.js release. Rollback: revert to next@16.2.0 or temporarily set skipLibCheck: true to suppress the error until an official fix is published.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state