Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect removal of newlines when comments, newlines, and Luau | type union is combined #617

Closed
Corecii opened this issue Oct 31, 2022 · 0 comments · Fixed by #626
Closed
Labels
bug Something isn't working

Comments

@Corecii
Copy link

Corecii commented Oct 31, 2022

The following code is incorrectly combined into one line:

type Table = {
	{
		Key -- [1]: Key
		| Translations -- [2]: Translations
		| Tags -- [3]: Tags
	}
}

becomes

type Table = { { Key -- [1]: Key | Translations -- [2]: Translations | Tags -- [3]: Tags } }

Use cases for this type of commenting:

  • In this case, it's done because Luau doesn't support typing indices of an array, so we use a union and document the indices with comments.
  • In other cases, it may be done to document something else about each type in the union. For example, instead of type aliasing Key = string, I might do string -- Key followed by another type on the next line, | { string } -- Tags
@Corecii Corecii changed the title Incorrect removel of newlines when comments, newlines, and Luau | type union is combined Incorrect removal of newlines when comments, newlines, and Luau | type union is combined Oct 31, 2022
@JohnnyMorganz JohnnyMorganz added the bug Something isn't working label Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants