Repository navigation
fix(generator): emit declare namespace instead of declare module - #316
Merged
Merged
Conversation
TypeScript 6 and 7 reject `module` for namespace declarations with TS1540, and `ignoreDeprecations: "6.0"` does not silence it. This blocked consumers that compile the generated types.ts from upgrading TypeScript beyond 5.9. The emitted declaration is semantically identical, so existing `MittwaldAPIV2.*` references keep working. Regenerated the v2 and v3-next clients from the checked-in specs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mfal
enabled auto-merge (squash)
October 16, 2026 07:57
ins0
approved these changes
Oct 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The generator wraps the generated
types.tsinexport declare module <Name> {. TypeScript 6 and 7 reject this with TS1540 ("A 'namespace' declaration should not be declared using the 'module' keyword"), andignoreDeprecations: "6.0"does not silence it. Consumers that compile the generated types (e.g. Nexus) are stuck on TypeScript ≤ 5.9.Changes
CodeGenerationModel.compileTypesemitsexport declare namespace <Name> {. This was the only namespace emitted withmodule; nested namespaces already usednamespace, and no real ambient module declarations are generated.v2andv3-nextclients regenerated from the checked-in prod specs — the diff is exactly that one line per file.Both keywords produce the same declaration, so references like
MittwaldAPIV2.Components.Schemas.*are unaffected.Verification
tsc --noEmit -p packages/mittwaldpasses with TypeScript 5.7.2 (repo), 5.9.3 and 7.0.2types.ts, TypeScript 7.0.2 fails withTS1540atsrc/generated/v2/types.ts(11,23)masterleaves the tree clean🤖 Generated with Claude Code