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

Take into account size of function definition when formatting return type #919

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

JohnnyMorganz
Copy link
Owner

Update the shape before formatting return type

Closes #896

Copy link
Contributor

Repo Comparison Test

diff --git ORI/CorePackages/modules/Collections/src/Array/map.lua ALT/CorePackages/modules/Collections/src/Array/map.lua
index 01b1443..88535aa 100644
--- ORI/CorePackages/modules/Collections/src/Array/map.lua
+++ ALT/CorePackages/modules/Collections/src/Array/map.lua
@@ -24,7 +24,9 @@ type callbackFnWithThisArg<T, U, V> = (thisArg: V, element: T, index: number, ar
 
 -- Implements Javascript's `Array.prototype.map` as defined below
 -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
-return function<T, U, V>(t: Array<T>, callback: callbackFn<T, U> | callbackFnWithThisArg<T, U, V>, thisArg: V?): Array<U>
+return function<T, U, V>(t: Array<T>, callback: callbackFn<T, U> | callbackFnWithThisArg<T, U, V>, thisArg: V?): Array<
+	U
+>
 	if _G.__DEV__ then
 		if typeof(t) ~= "table" then
 			error(string.format("Array.map called on %s", typeof(t)))

@JohnnyMorganz
Copy link
Owner Author

Not a very nice diff. Need to solve that

@JohnnyMorganz JohnnyMorganz marked this pull request as draft November 17, 2024 16: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.

Long function with multiple generic return types formats inconsistently
1 participant