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

Changes contract of void functions #4

Open
turadg opened this issue Sep 17, 2018 · 0 comments
Open

Changes contract of void functions #4

turadg opened this issue Sep 17, 2018 · 0 comments

Comments

@turadg
Copy link

turadg commented Sep 17, 2018

This is most evident in React lifecycle methods like componentDidMount which is transforms to an async method. (Currently componentDidMount async function due to #3 )

Regardless of whether it's for React, doesn't seem prudent for this codemod to change the contract of the code. E.g.,

function doesSomethingWithAPromise(): void {
  promise.then(doSomething);
}

is being converted to:

async function doesSomethingWithAPromise(): Promise<void> {
  await promise;
  doSomething();
}

(hypothetically, haven't tested with this particular snippet) Point is that the return type has been changed from void to Promise<void>.

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

No branches or pull requests

1 participant