Skip to content

Conversation

@mrgrain
Copy link
Contributor

@mrgrain mrgrain commented Dec 5, 2025

Consolidates multiple selective imports from the same module source into a single import statement, reducing redundancy in generated TypeScript code.

The TypeScript renderer now:

  • Groups selective imports by source module
  • Merges all imported names from the same source
  • Sorts imports alphabetically by name
  • Preserves aliased imports correctly
  • Keeps aliased module imports (import * as) separate from selective imports

This improves code generation quality by eliminating duplicate import statements when multiple parts of the code import different symbols from the same module.

@mrgrain mrgrain changed the title feat(typewriter): deduplicate imports feat(typewriter): deduplicate selective imports from same source Dec 5, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

@aws-cdk/aws-service-spec: No model change detected

Base automatically changed from mrgrain/feat/typewriter/aliased-selective-imports to main December 5, 2025 06:28
@mrgrain mrgrain force-pushed the mrgrain/feat/typewriter-deduplicate-imports branch from ddbb950 to 24dee6f Compare December 5, 2025 19:17
@mrgrain mrgrain marked this pull request as ready for review December 5, 2025 19:18
@aws-cdk-automation aws-cdk-automation added this pull request to the merge queue Dec 5, 2025
Merged via the queue into main with commit 98f4773 Dec 5, 2025
13 checks passed
@aws-cdk-automation aws-cdk-automation deleted the mrgrain/feat/typewriter-deduplicate-imports branch December 5, 2025 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants