Skip to content

Fix adding unnecessary colons on Mapped Types#7221

Merged
thorn0 merged 7 commits intoprettier:masterfrom
cola119:issue/7174
Jan 6, 2020
Merged

Fix adding unnecessary colons on Mapped Types#7221
thorn0 merged 7 commits intoprettier:masterfrom
cola119:issue/7174

Conversation

@cola119
Copy link
Copy Markdown
Contributor

@cola119 cola119 commented Jan 5, 2020

fixes #7174
This is my first time submitting PR. 🙇

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory)
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/pr-XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

@armano2
Copy link
Copy Markdown
Contributor

armano2 commented Jan 5, 2020

@cola119 can you add test case?

type Anys = { [K in Keys]+? };

type Keys = 'option1' | 'option2';
type Flags = { [K in Keys]: boolean };

type Anys = { [K in Keys] };
Copy link
Copy Markdown
Contributor

@sosukesuzuki sosukesuzuki Jan 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with the background, but I think it is better to create new directory named /tests/typescript_mapped_type than adding tests to /tests/typescripts/conformance.
(I was previously pointed on a similar thing from @thorn0 . See #6604 (comment))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense. I'll try it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait, should I create new tests at /tests/typescript_mapped_type while leaving /tests/typescripts/conformance/mappedType.ts? Or move /tests/typescripts/conformance/mappedType.ts to /tests/typescript_mapped_type?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understood the problem by reading the above conversation so I'm going to create new dir while keeping /conformance/mappedType.ts before 🙇

@@ -0,0 +1,3 @@
type Keys = 'option1' | 'option2';
type A = { [K in Keys] };
type B = { [K in Keys]+? };
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@armano2 is this as intended? 🤔

Copy link
Copy Markdown
Contributor

@armano2 armano2 Jan 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Co-Authored-By: Georgii Dolzhykov <thorn.mailbox@gmail.com>
@thorn0 thorn0 merged commit e11b6e8 into prettier:master Jan 6, 2020
@cola119 cola119 deleted the issue/7174 branch January 8, 2020 00:42
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Apr 15, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Apr 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Format error syntax with language typescript

5 participants