Skip to content

fix: support spaceSurroundingProperties for mapped types via mappedType.spaceSurroundingProperties - #883

Merged
dsherret merged 1 commit into
mainfrom
fix-mapped-type-space-surrounding
Nov 4, 2026
Merged

dsherret merged 1 commit into
mainfrom
fix-mapped-type-space-surrounding

Conversation

@dsherret

@dsherret dsherret commented Nov 4, 2026

Copy link
Copy Markdown
Member

Closes #567

spaceSurroundingProperties: false didn't apply to mapped types:

type Test = { [key in string]: string };

This adds mappedType.spaceSurroundingProperties, which falls back to the global spaceSurroundingProperties like the other per-node spaceSurroundingProperties options (and like mappedType.preferSingleLine). With it set to false:

type Test = {[key in string]: string};

The default is true, so default output is unchanged.

Tests

  • issue0567.txt has the issue's example with the global option.
  • MappedType_SpaceSurroundingProperties_False.txt covers fitting on the line only without the spaces, readonly, as clauses, and multi-line input.
  • MappedType_PreferSingleLine_True_SpaceSurroundingProperties_False.txt combines it with mappedType.preferSingleLine.
  • SpaceSurroundingProperties_False.txt has a mapped type.

@dsherret
dsherret merged commit 0d1634d into main Nov 4, 2026
1 check failed
@dsherret
dsherret deleted the fix-mapped-type-space-surrounding branch November 4, 2026 22:27
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.

spaceSurroundingProperties not working with mapped types

1 participant