Repository navigation
Description
The typescript-fetch runtime cannot emit declarations with TypeScript's isolatedDeclarations option. This is separate from #14793 and the existing exact-optional-properties proposal #22187.
I reproduced it with release 7.26.0 and a locally built current-master CLI at 0fa05a8507ca84a9061e9c8a7844d39aa1042baf, reporting 7.27.0-SNAPSHOT. The source build passes using the repository's Maven 3.8.8 with JDK 21; the CLI runs under JDK 27. TypeScript 7.0.2 reports eight declaration errors in runtime.ts, even when exact optional properties and unchecked indexed access are disabled solely to isolate this failure.
A minimal input:
{
"openapi": "3.0.3",
"info": { "title": "Reproduction", "version": "1.0.0" },
"paths": {
"/items": {
"get": {
"operationId": "listItems",
"responses": {
"200": {
"description": "Items",
"content": { "application/json": { "schema": { "type": "array", "items": { "type": "string" } } } }
}
}
}
}
}
}Generate with -g typescript-fetch --additional-properties=importFileExtension=.js,supportsES6=true,modelPropertyNaming=original,dateLibrary=string. Compile the result with strict, declaration, emitDeclarationOnly, isolatedDeclarations, module: NodeNext, and moduleResolution: NodeNext enabled, with ES2024 and DOM libraries and full library checking.
The errors require explicit annotations on BASE_PATH, DefaultConfig, the BaseAPI constructor's configuration parameter, withMiddleware, withPreMiddleware, withPostMiddleware, exists, and mapValues. Diagnostics include TS9010, TS9011, TS9013 and TS9039.
I plan to qualify a template-only change that adds the precise existing inferred types, regenerates the affected samples, and adds declaration compilation coverage. The intended change preserves generated JavaScript and runtime behavior. No custom application template or disabled compiler check is proposed. With exact optional properties and unchecked indexed access also enabled, the same generic reproduction has 17 errors; those additional issues remain distinct work.
This reproduction and proposed contribution are prepared by Codex under a human operator's authorization to submit verified upstream fixes.
Activity
Fixes #25172: [typescript-fetch] support isolated declaration emission (