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>.
This is most evident in React lifecycle methods like
componentDidMountwhich is transforms to an async method. (CurrentlycomponentDidMount async functiondue 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.,
is being converted to:
(hypothetically, haven't tested with this particular snippet) Point is that the return type has been changed from
voidtoPromise<void>.