Skip to content

Changes contract of void functions #4

@turadg

Description

@turadg

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>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions