Skip to content

tupleReturn improvements#445

Merged
tomblind merged 3 commits intomasterfrom
tuple-return-improvements
Feb 23, 2019
Merged

tupleReturn improvements#445
tomblind merged 3 commits intomasterfrom
tuple-return-improvements

Conversation

@tomblind
Copy link
Copy Markdown
Collaborator

  • fixed @tupleReturn on arrow functions
const fn = /** @tupleReturn */ s => [s, s];
  • enabled inference of tupleReturn on arrow functions
/** @tupleReturn */ interface Fn { (s: string): [string, string] }
const fn: Fn = s => [s, "bar"]; // the arrow function will now correctly keep return values unpacked
  • preventing wrap+unpack when using spread operator on tupleReturn function
/** @tupleReturn */ declare function foo(): [string, string];
declare function bar(a: string, b: string): void;
bar(...foo()); // will no longer be 'bar(table.unpack({foo()}))'

- fixed `@tupleReturn` on arrow functions
- enabled inference of tupleReturn on arrow functions
- preventing wrap+unpack when using spread operator on tupleReturn function
@tomblind tomblind merged commit 9b558d2 into master Feb 23, 2019
@tomblind tomblind deleted the tuple-return-improvements branch February 23, 2019 16:57
hazzard993 pushed a commit to hazzard993/TypescriptToLua that referenced this pull request Feb 26, 2019
* tupleReturn improvements
- fixed `@tupleReturn` on arrow functions
- enabled inference of tupleReturn on arrow functions
- preventing wrap+unpack when using spread operator on tupleReturn function

* added tests for argument inference

* better name
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.

2 participants